Skip to content

fix: prevent ghost click on settings gear during touch expand - #1061

Open
prushforth wants to merge 1 commit into
Maps4HTML:mainfrom
prushforth:layer-control-touch-fix
Open

fix: prevent ghost click on settings gear during touch expand#1061
prushforth wants to merge 1 commit into
Maps4HTML:mainfrom
prushforth:layer-control-touch-fix

Conversation

@prushforth

Copy link
Copy Markdown
Member

On touch devices, tapping the collapsed layer control toggle fires synthetic mouseenter before the synthetic click. mouseenter expands the panel, hiding the toggle (display:none). The browser then retargets the click to whatever element now occupies those coordinates — the settings gear button — inadvertently toggling layer settings on every expand.

Handle touchend on the toggle with preventDefault() to suppress all synthetic mouse events, and call expand() directly. Also add a touchstart listener on the map container for reliable tap-to-dismiss, since movestart alone does not fire on a plain tap (no pan).

On touch devices, tapping the collapsed layer control toggle fires
synthetic mouseenter before the synthetic click. mouseenter expands the
panel, hiding the toggle (display:none). The browser then retargets the
click to whatever element now occupies those coordinates — the settings
gear button — inadvertently toggling layer settings on every expand.

Handle touchend on the toggle with preventDefault() to suppress all
synthetic mouse events, and call expand() directly. Also add a
touchstart listener on the map container for reliable tap-to-dismiss,
since movestart alone does not fire on a plain tap (no pan).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant