Skip to content

Conversation

sielay
Copy link

@sielay sielay commented Aug 23, 2023

The problem I faced is that I render editable elements in an iframe (forced by CSS I'm dependent on, long story). I use React.Portal and because the code is defined in the main window and the elements are in different the library gets confused and ends up with Uncaught DOMException: Failed to execute 'getRangeAt' on 'Selection': 0 is not a valid index. on any commit.

The fix is to allow to pass reference object to the window from the iframe.

It will use window of the element and fallback to global window otherwise. This had to be applied to all window and document references. It was tested in the iframe, selection control and updates works. Range doesn't throw anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants