react icon indicating copy to clipboard operation
react copied to clipboard

fix: firefox Uncaught DOMException: Selection.extend: No selection ra…

Open nusr opened this issue 1 year ago • 4 comments

…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

nusr avatar Jun 27 '23 03:06 nusr