react
react copied to clipboard
fix: firefox Uncaught DOMException: Selection.extend: No selection ra…
…nge exists
Summary
If Selection.extend is called while another element has focus, an error is thrown. We therefore disable extend
if the active element is somewhere other than the node we are selecting. This should only occur in Firefox, since it is the only browser to support multiple selections.See https://bugzilla.mozilla.org/show_bug.cgi?id=921444.
Firefox will trrigger InvalidStateError: Selection.extend: No selection range exists
.
Safari will trigger InvalidStateError: extend() requires a Range to be added to the Selection
.
How did you test this change?
The code logic refers to draft-js fix #26980