3# 🐛 Bug report
Dialog backdrop can allow click-through when an underlying element explicitly sets pointer-events: auto.
When a Zag Dialog is opened, background content should not be interactive. However, the current pointer-blocking strategy appears to set pointer-events: none on body. If a descendant under the backdrop has pointer-events: auto, that element can still receive clicks even though it is visually covered by the backdrop.
Kind like #1720
💥 Steps to reproduce
- Open Dialog
- Try to hover or click the link element
💻 Link to reproduction
See: https://stackblitz.com/edit/3gfyhysi?file=src%2FDialog.tsx
🧐 Expected behavior
When a modal dialog is open, background content should not receive pointer events, regardless of whether descendants explicitly set pointer-events: auto.
The backdrop/positioner should reliably block interaction with all non-dialog content.
🧭 Possible Solution
-
Use an inert-based strategy for modal background suppression, such as suppressOthers() which already in zagjs (suppressOthers is a inert-frist prevented function), instead of relying only on aria-hidden and body-level pointer-events: none.
-
A quick hack way is let your dialog backdrop element has pointer-events: auto to intercept and consume the click event.
🌍 System information
| Software |
Version(s) |
| Zag Version |
@zag-js/dialog@1.41.2 |
| Browser |
Chrome |
| Operating System |
Windows 11 |
3# 🐛 Bug report
Dialog backdrop can allow click-through when an underlying element explicitly sets
pointer-events: auto.When a Zag Dialog is opened, background content should not be interactive. However, the current pointer-blocking strategy appears to set
pointer-events: noneonbody. If a descendant under the backdrop haspointer-events: auto, that element can still receive clicks even though it is visually covered by the backdrop.Kind like #1720
💥 Steps to reproduce
💻 Link to reproduction
See: https://stackblitz.com/edit/3gfyhysi?file=src%2FDialog.tsx
🧐 Expected behavior
When a modal dialog is open, background content should not receive pointer events, regardless of whether descendants explicitly set
pointer-events: auto.The backdrop/positioner should reliably block interaction with all non-dialog content.
🧭 Possible Solution
Use an inert-based strategy for modal background suppression, such as
suppressOthers()which already in zagjs (suppressOthersis ainert-frist prevented function), instead of relying only onaria-hiddenand body-levelpointer-events: none.A quick hack way is let your dialog backdrop element has
pointer-events: autoto intercept and consume the click event.🌍 System information
@zag-js/dialog@1.41.2