menuShouldBlockScroll not working properly when the select is mounted in a separate window but execution context is in main window #5346
Labels
issue/bug-unconfirmed
Issues that describe a bug that hasn't been confirmed by a maintainer yet
Are you reporting a bug or runtime error?
A bug.
react-select version
5.4.0
I have an app that uses React Portals to mount components in separate windows/popups (we use react-new-window
package to achieve that.
The thing is that in such a use case, the markup and components are rendered in the external HTML page (popup) but the javascript execution context is still in the main window so referring objects like
window
ordocument
could produce errors because the document on the external page (where the component is rendered) is different than the one where the javascript executes.One example of such an issue is when we use
menuShouldBlockScroll
config. When it's used, the library adds afixed
positioned element to the page and attachesonClick
event on it to blur the select. The issue is that the event listener looks fordocument.activeElement
which is wrong in my use case as it refers to the main document, not the popup one where the component is mounted.I found a simple solution for that one and will push a pull request with it soon.
The text was updated successfully, but these errors were encountered: