fix(drawing): Fix cannot focus drawing annotations on IE11#634
fix(drawing): Fix cannot focus drawing annotations on IE11#634mergify[bot] merged 2 commits intobox:masterfrom
Conversation
| event.currentTarget.focus(); | ||
| } else { | ||
| // IE11 does not support focus function; call handleFocus directly | ||
| handleFocus(); |
There was a problem hiding this comment.
Interesting, does this reduce the number of SET_ACTIVE_ANNOTATION_ID actions triggered?
Should this be done for HighlightTarget as well?
There was a problem hiding this comment.
It does reduce the number of actions by 1 compared to HighlightTargt. But the purpose of this PR is to fix that onSelect will not be called if event.currentTarget.focus doesn't exist in IE and it errors out. It also removes the console error.
There was a problem hiding this comment.
You dared to open ie11 dev tools 😁
| event.currentTarget.focus(); // Buttons do not receive focus in Firefox and Safari on MacOS; triggers handleFocus | ||
|
|
||
| onSelect(annotationId); | ||
| if (event.currentTarget.focus) { |
There was a problem hiding this comment.
minor: could be more compact with something like:
const focusFn = event.currentTarget.focus || handleFocus;
focusFn();
There was a problem hiding this comment.
How about (event.currentTarget.focus || handleFocus)()? Haha actually I think the current way is easy to read and easy to add comments.
No description provided.