New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modals: Unable to preventDefault inside passive event listener #4608
Comments
The problem seems to be caused by events that are passed "trough" the modal to the underlying carousel component. |
From where is |
From within the React Slick component: I now found out that the slider reacts on touch swipes, although it is completely covered by the modal. I can even swipe through the pages by swiping over the modal (I checked this by adding a callback whenever a slide transition happens). Shouldn't the modal block all clicks (or touch events) from going through to content behind it? It might also be that the carousel itself sets up global event handlers. |
I created an issue in React Slick, too: akiran/react-slick#1650 |
The same problem applies to |
I can confirm that events are actually passed through the modal to the underlying components. Which is most likely not what you would intend, because it can cause a lot of unwanted side-effects. Imagine if you tapped on a delete button hidden below the modal... IIRC, regular bootstrap blocks all events from getting through. |
I try to use a Modal inside a slide of the React Slick carousel:
https://github.com/akiran/react-slick
Each slide contains an editable media element (e.g. a picture or a YouTube video), and the modal is being used to edit this media element.
Before I added the carousel (i.e. until I used only one editable media object on the page), everything worked fine. But since I packed the media elements into the slides of the carousel, I am getting a weird error from Chome related to event bubbling when removing the modal from the DOM (by not rendering it anymore):
[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/5093566007214080
In effect, the Modal stays on the screen. Same behaviour on Safari iOS (without an error message, though; the modal just stays there).
I am not exactly sure if this problem is caused by React Bootstrap or React Slick, but I think it might be related to the fact that the modal is being rendered outside the regular app's DOM hierarchy.
Note: there is only one modal being shown at a time.
The text was updated successfully, but these errors were encountered: