Why we need stop propagation here? #2688
Replies: 3 comments
-
This is the default for us. You can use capturing listeners (https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#parameters see capture) in order to get ahead of them for things like closing dialogs. Though if I'm reading that right, you're trying to close the dialog when someone clicks on a button outside of the dialog? If that's correct, you should really put up an underlay to prevent interactions with things outside the dialog. This will help mitigate the case you're talking about. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the fast and detailed response. |
Beta Was this translation helpful? Give feedback.
-
Of course, sorry, I forgot to address the why in my previous message. This is probably the most relevant discussion explaining why we do it #2100 (comment) |
Beta Was this translation helpful? Give feedback.
-
react-spectrum/packages/@react-aria/interactions/src/usePress.ts
Line 326 in 4312f19
We are capturing the left mouse click events for closing dialogs and more..
Now, when users click on usePress elements the event is stopping, and I wonder if there is any reason for that.
Beta Was this translation helpful? Give feedback.
All reactions