base-ui
base-ui copied to clipboard
[Dialog][Popover] Prevent outside touch interactions
To explore:
- Always prevent outside touch interactions, even with
modal={false}- Truly non-modal popups are always problematic on mobile devices because there are no hovers to indicate whether outside interactions will activate the interactive elements beneath
- There tends to be much less "free" space for a safe click out on mobile
- When dismissing popups with outside interactions, do we want to close the component using
touchstartortouchend?- All native iOS popups close on touch start
- Counter point: closing on
touchstartmight make zooming/panning harder
With backdrops, we can't use touchstart (actually, pointerdown) since the event falls through the backdrop and triggers events on elements where the touch occurred, even if it was modal. That's the same issue mentioned for point number 1. The mousedown event (currently used) works lazily on touch, but eagerly with mouse.