You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I set up the dev server with the docs on my machine to see if this was my setup, but it happens there too.
When creating a Select component with menuPortalTarget={document.body} and menuShouldBlockScroll={true} and opening the select, a click event is propagated to the document, even when I've wrapped the select component in a div with onClick={e => e.stopPropagation()}.
This would be logical when clicking on the menu itself (which is rendered in a portal so outside of my stopPropagation), but not when clicking on the input itself, which is definitely still a child of the propagation-stopping div.
I need the combination of both of these props to fix other issues in my app (mainly z-index issues and this one: #4088)
In my app, I'm rendering the select in a dropdown that listens to a click event on document to close the dropdown, opening the select instantly closes the dropdown because of this bug.
I've narrowed it down to this fixed div being rendered over the screen (which I believe is all menuShouldBlockScroll does):
Even when wrapping the ScrollManager in a div that stops propagation of the click event, this still happens.
The click event has a srcElement of body for some reason. Could this mean this is being caused by a strange combination of a mouseUp and mouseDown event being triggered on 2 separate elements?
Any idea what I could do differently to get this to work, or any pointers to how I could better debug this?
The text was updated successfully, but these errors were encountered:
I have faced another problem with this combination. If menuPortalTarget={document.body} and menuShouldBlockScroll={true} you cant interact with the control itself: e.g. you can't delete value in multiple mode. This property is useful in floating contexts, like popup.
Another solution - closeMenuOnScroll={true} also does NOT work in scroll containers. Looks like it only works for body, not any container. So it leads to the situation where menu is unattached from control. So there is no stable solution to make select work inside popup with scrollable content.
Are you reporting a bug or runtime error?
Bug
I set up the dev server with the docs on my machine to see if this was my setup, but it happens there too.
When creating a
Select
component withmenuPortalTarget={document.body}
andmenuShouldBlockScroll={true}
and opening the select, aclick
event is propagated to thedocument
, even when I've wrapped the select component in a div withonClick={e => e.stopPropagation()}
.This would be logical when clicking on the menu itself (which is rendered in a portal so outside of my stopPropagation), but not when clicking on the input itself, which is definitely still a child of the propagation-stopping div.
I need the combination of both of these props to fix other issues in my app (mainly z-index issues and this one: #4088)
In my app, I'm rendering the select in a dropdown that listens to a
click
event ondocument
to close the dropdown, opening the select instantly closes the dropdown because of this bug.I've narrowed it down to this fixed div being rendered over the screen (which I believe is all
menuShouldBlockScroll
does):react-select/packages/react-select/src/internal/ScrollManager.tsx
Lines 45 to 50 in 4d3b1aa
Even when wrapping the
ScrollManager
in a div that stops propagation of the click event, this still happens.The click event has a
srcElement
ofbody
for some reason. Could this mean this is being caused by a strange combination of a mouseUp and mouseDown event being triggered on 2 separate elements?Any idea what I could do differently to get this to work, or any pointers to how I could better debug this?
The text was updated successfully, but these errors were encountered: