Skip to content

fix: prevent backdrop click-through in iOS home screen apps (#12056) (CP: 25.2) - #12062

Merged
web-padawan merged 1 commit into
25.2from
cherry-pick-12056-to-25.2-1783586124996
Jul 9, 2026
Merged

fix: prevent backdrop click-through in iOS home screen apps (#12056) (CP: 25.2)#12062
web-padawan merged 1 commit into
25.2from
cherry-pick-12056-to-25.2-1783586124996

Conversation

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This PR cherry-picks changes from the original PR #12056 to branch 25.2.


Original PR description

When the app-layout drawer is open as an overlay on iOS home screen
(standalone) apps, tapping the backdrop to close the drawer also triggers a
click on the element behind the backdrop.

The backdrop already calls preventDefault() on touchend to stop the
synthesized "ghost" click. This works in Safari tabs, but iOS does not honor
it in standalone (home screen) apps. Because closing the drawer makes the
backdrop stop capturing pointer events, the ghost click then reaches the
element behind it.

Reproduction

  1. Open the app-layout demo on iOS and add it to the home screen.
  2. Launch it from the home screen and open the drawer.
  3. Tap the backdrop over an interactive element (e.g. a button). The drawer
    closes and the element behind also receives the click.

Only reproduces in the installed app, and only for medium-length taps
(roughly 300–1000 ms).

Changes

  • In standalone mode only, swallow the upcoming ghost click at the tap
    position in the capture phase, so regular mouse, keyboard, and touch clicks
    elsewhere are never affected. The listener is removed after a short timeout
    and on disconnect.
  • Fix an unrelated pre-existing leak: disconnectedCallback removed the
    close-overlay-drawer listener with the wrong function reference.

Fixes #11690


🤖 Generated with Claude Code

When the app-layout drawer is open as an overlay on iOS home screen
(standalone) apps, tapping the backdrop to close the drawer also
triggers a
click on the element behind the backdrop.

The backdrop already calls `preventDefault()` on `touchend` to stop the
synthesized "ghost" click. This works in Safari tabs, but iOS does not
honor
it in standalone (home screen) apps. Because closing the drawer makes
the
backdrop stop capturing pointer events, the ghost click then reaches the
element behind it.

## Reproduction

1. Open the app-layout demo on iOS and add it to the home screen.
2. Launch it from the home screen and open the drawer.
3. Tap the backdrop over an interactive element (e.g. a button). The
drawer
   closes and the element behind also receives the click.

Only reproduces in the installed app, and only for medium-length taps
(roughly 300–1000 ms).

## Changes

- In standalone mode only, swallow the upcoming ghost click at the tap
position in the capture phase, so regular mouse, keyboard, and touch
clicks
elsewhere are never affected. The listener is removed after a short
timeout
  and on disconnect.
- Fix an unrelated pre-existing leak: `disconnectedCallback` removed the
  `close-overlay-drawer` listener with the wrong function reference.

Fixes #11690

---

🤖 Generated with Claude Code
@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

@web-padawan
web-padawan merged commit 61e360b into 25.2 Jul 9, 2026
12 of 13 checks passed
@web-padawan
web-padawan deleted the cherry-pick-12056-to-25.2-1783586124996 branch July 9, 2026 09:18
@vaadin-bot

Copy link
Copy Markdown
Collaborator Author

This ticket/PR has been released with Vaadin 25.2.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants