Re: [pointerevents] Add context for popover light dismiss to click event (#542)

Thanks Mustaq and Rob!

> Add a mechanism for containing clicks across particular boundaries. The general pattern would be that clicks would not be generated if the down and up events occur on different container boundaries. E.g. if you start clicking inside a button and your mouse goes up outside of that button, perhaps it shouldn't generate a click since the button is a clickable component that you started interacting with. Strawman proposal: `pointer-contain: click` or `pointer-contain: mouse`.

This makes a lot of sense, but would it break any sites if we just started doing that? Is that what the CSS properties are for? I don't fully understand how they would work.

> Maybe we do (2) implicitly for popover. I.e. if you start clicking on something inside the popover, and stop outside the popover, that does not result in a click.

This sounds like it would give us similar behavior that we already have for light dismiss, but if you click and drag across nodes outside of the popover it doesn't trigger light dismiss right now. I'm not sure if that's important behavior to preserve though.

> Maybe things like popover which go into the top layer should also affect the event ancestor chain (and propagation?) in a way that would result in the common ancestor of a click that starts inside the popover and ends outside of it either doesn't exist (i.e. above root) or is the root.

Not firing click at all in this case sounds best to me and would make it so popover light dismiss can just run when click events are dispatched and not have to do its own click and drag detection.

> Expose down and up targets (or events) that resulted in the click. Popover could then ignore the click if either of the triggering events was inside the popover.

This certainly does sound like the easiest option which has the least change on existing behavior. I already started [implementing](https://chromium-review.googlesource.com/c/chromium/src/+/6664038) it.

-- 
GitHub Notification of comment by josepharhar
Please view or discuss this issue at https://github.com/w3c/pointerevents/issues/542#issuecomment-3080769568 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 16 July 2025 21:07:27 UTC