How to let other component capture click while Dialog is open? #1877
-
This question is similar to #1720. Current BehaviorMy app might pop a toast at any time. And the toast could be closed by click on it. Here is the simulation: bandicam.2023-01-07.17-17-17-477.mp4What I had tried
What I WantHow can I make the click once per element. That is, first click close toast and second click close Dialog. CodeSandboxThis example code is a tweak version from the documentation. The tweaks: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
With 2. you are mostly there, all you'd need to do is make sure you don't close when interacting outside the dialog if the interaction is inside the toast region. You can use a data attribute or classname or anything you want to check the origin of the event, and call |
Beta Was this translation helpful? Give feedback.
With 2. you are mostly there, all you'd need to do is make sure you don't close when interacting outside the dialog if the interaction is inside the toast region. You can use a data attribute or classname or anything you want to check the origin of the event, and call
event.preventDefault()
inonPointerDownOutside
when that matches.