Skip to content

[web] Remove the a11y placeholder only after the gesture ends - #194109

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
flutter-zl:issue_194104_fix
Oct 13, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
flutter-zl:issue_194104_fix

Conversation

@flutter-zl

Copy link
Copy Markdown
Contributor

Fixes #194104

Problem

On mobile, the engine covers each view with a semantics placeholder and removes it after 20 events that do not activate a screen reader. On non-WebKit browsers it removed the placeholder on the very next event, usually a pointermove in the middle of a drag. That placeholder is the drag's target, and when the page lets the browser pan and cancels touchmove, Chrome on Android stops delivering the rest of the drag, including its pointerup, so the framework keeps the pointer down forever.

Fix

Remove the placeholder only on touchend, pointerup, or click, once the gesture that targets it has ended, on every browser engine. WebKit has used this rule since the placeholder was added. Accessibility was already given up on, so the only change is that the placeholder goes away when the finger lifts instead of mid-gesture.

Demo

On an Android phone in Chrome, reload the page, do one long, slow drag on the list, and lift the finger.
Before, "Pointers down" stays at 1: https://flutter-demo-77-before.web.app
After, "Pointers down" returns to 0 and the list is idle: https://flutter-demo-77-after.web.app

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Oct 9, 2026
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) platform-web Web applications specifically team-web Owned by Web platform team labels Oct 9, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the semantics placeholder removal logic in MobileSemanticsEnabler to trigger on touchend, pointerup, or click events across all browser engines, ensuring the targeting gesture has completed before removal, and adds a test for this behavior. The review feedback recommends extending this logic and documentation to also handle touchcancel and pointercancel events, preventing placeholders from remaining in the DOM if a gesture is canceled.

Comment on lines +357 to +358
/// The placeholders are removed upon the next "touchend", "pointerup", or
/// "click" event, once the gesture that targets them has ended. Removing them

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Update the documentation to also mention touchcancel and pointercancel events, as they also signal the end of a gesture.

Suggested change
/// The placeholders are removed upon the next "touchend", "pointerup", or
/// "click" event, once the gesture that targets them has ended. Removing them
/// The placeholders are removed upon the next "touchend", "pointerup",
/// "touchcancel", "pointercancel", or "click" event, once the gesture that
/// targets them has ended. Removing them

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

event.type == 'touchend' ||
event.type == 'pointerup' ||
event.type == 'click';
event.type == 'touchend' || event.type == 'pointerup' || event.type == 'click';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The gesture can also end due to cancellation (e.g., when a system gesture takes over or the touch is disrupted). In these cases, pointercancel or touchcancel events are fired instead of pointerup or touchend. If we do not remove the placeholder on cancellation, it will remain in the DOM and potentially block subsequent interactions. We should include pointercancel and touchcancel as events that trigger placeholder removal.

Suggested change
event.type == 'touchend' || event.type == 'pointerup' || event.type == 'click';
event.type == 'touchend' ||
event.type == 'pointerup' ||
event.type == 'click' ||
event.type == 'touchcancel' ||
event.type == 'pointercancel';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@flutter-zl
flutter-zl requested a review from mdebbar October 10, 2026 00:04
@flutter-zl flutter-zl added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 13, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 13, 2026
Merged via the queue into flutter:master with commit 7e115a9 Oct 13, 2026
23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 13, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 14, 2026
Roll Flutter from 4249ccbc18a3 to 426be968b5eb (44 revisions)

flutter/flutter@4249ccb...426be96

2026-10-14 awolff@google.com Allow color delta tolerance in in-memory fuzzy image comparator (flutter/flutter#193937)
2026-10-14 zhongliu88889@gmail.com [web] Drop stale composing range after text is replaced mid-composition (flutter/flutter#194096)
2026-10-14 engine-flutter-autoroll@skia.org Roll Skia from 2a2bbea66844 to acde3755d2e2 (1 revision) (flutter/flutter#194376)
2026-10-14 engine-flutter-autoroll@skia.org Roll Skia from 128c983b12de to 2a2bbea66844 (1 revision) (flutter/flutter#194371)
2026-10-14 engine-flutter-autoroll@skia.org Roll Skia from 48a294ed4955 to 128c983b12de (3 revisions) (flutter/flutter#194353)
2026-10-14 kevmoo@users.noreply.github.com feat(flutter_tools): extract WebDebugConfig from DebuggingOptions (flutter/flutter#194312)
2026-10-14 engine-flutter-autoroll@skia.org Roll Skia from ea6781c5b6d1 to 48a294ed4955 (2 revisions) (flutter/flutter#194349)
2026-10-14 chingjun@google.com Include <vector> in Android proc_table.h. (flutter/flutter#194325)
2026-10-14 engine-flutter-autoroll@skia.org Roll Dart SDK from 5933cb486b4a to 6b50116630d0 (28 revisions) (flutter/flutter#194341)
2026-10-14 97480502+b-luk@users.noreply.github.com Move GLES3 instancing API entry points to FOR_EACH_IMPELLER_GLES3_PROC (flutter/flutter#194319)
2026-10-14 kevmoo@users.noreply.github.com feat(flutter_tools): extract AndroidGradleConfig and move toGradleConfig to AndroidBuildInfo (flutter/flutter#194016)
2026-10-14 engine-flutter-autoroll@skia.org Roll Skia from ae297bec6012 to ea6781c5b6d1 (8 revisions) (flutter/flutter#194331)
2026-10-14 bkonyi@google.com [flutter_tools] Migrate gradle_errors and deferred_components_prebuild_validator away from globals (flutter/flutter#193649)
2026-10-14 kevmoo@users.noreply.github.com [Impeller] Cache GLES sampler configuration in RenderPassStateCache (flutter/flutter#193922)
2026-10-14 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#194332)
2026-10-13 bkonyi@google.com [tool] Migrate RunCommand to modular dependency injection (flutter/flutter#190791)
2026-10-13 mdebbar@google.com Include `engine/src/flutter/.ci.yaml` in quarterly `goldctl` checklist (flutter/flutter#194316)
2026-10-13 nshahan@google.com [flutter_tools] Remove the last AMD module system support (flutter/flutter#193607)
2026-10-13 engine-flutter-autoroll@skia.org Roll Skia from 8b3394a60654 to ae297bec6012 (5 revisions) (flutter/flutter#194310)
2026-10-13 zhongliu88889@gmail.com [web] Remove the a11y placeholder only after the gesture ends (flutter/flutter#194109)
2026-10-13 mdebbar@google.com Upgrade goldctl to the latest version (flutter/flutter#193932)
2026-10-13 bkonyi@google.com [flutter_tools] Lazily initialize AndroidStudio validation and optimize candidate selection (flutter/flutter#191968)
2026-10-13 68429735+Vonarian@users.noreply.github.com [flutter_tools] Clean up outdated widget preview TODOs and refactor static state (flutter/flutter#189437)
2026-10-13 engine-flutter-autoroll@skia.org Roll Skia from e5b5db6d0d6f to 8b3394a60654 (2 revisions) (flutter/flutter#194306)
2026-10-13 matt.boetger@gmail.com Redistribute TESTOWNERS for Android team (flutter/flutter#193861)
2026-10-13 kevmoo@users.noreply.github.com feat(flutter_tools): introduce Test and Drive specification objects (flutter/flutter#194017)
2026-10-13 santoshakil@users.noreply.github.com [Impeller] Keep the aspect ratio when shrinking images to the max texture size (flutter/flutter#194010)
2026-10-13 pq@users.noreply.github.com [flutter tool] preserve inherited `DASH__SUPPRESS_ANALYTICS=true` for sub-tools (flutter/flutter#194261)
2026-10-13 engine-flutter-autoroll@skia.org Roll Packages from d8d9e97 to a1ed23c (9 revisions) (flutter/flutter#194302)
2026-10-13 manjian2006@gmail.com Use PE/COFF AOT snapshots for Windows x64 (flutter/flutter#187594)
2026-10-13 omar.alshyokh@gmail.com Fix Expansible crash when PageStorage holds a non-bool value (flutter/flutter#192195)
2026-10-13 engine-flutter-autoroll@skia.org Roll Skia from ffeccb3ca58a to e5b5db6d0d6f (1 revision) (flutter/flutter#194297)
2026-10-13 49402500+fahaddoc@users.noreply.github.com Explain why initState() is too early to depend on an inherited widget (flutter/flutter#192727)
2026-10-13 victorsanniay@gmail.com Refactor TestPlatformDispatcher (flutter/flutter#192747)
2026-10-13 engine-flutter-autoroll@skia.org Roll Skia from 3de0984208ec to ffeccb3ca58a (2 revisions) (flutter/flutter#194291)
2026-10-13 engine-flutter-autoroll@skia.org Roll Skia from 0580c2b780f6 to 3de0984208ec (2 revisions) (flutter/flutter#194281)
2026-10-13 engine-flutter-autoroll@skia.org Roll Skia from f641d55e07a8 to 0580c2b780f6 (3 revisions) (flutter/flutter#194275)
2026-10-13 engine-flutter-autoroll@skia.org Roll Skia from 0e5d8d1be81b to f641d55e07a8 (1 revision) (flutter/flutter#194266)
2026-10-13 victorsanniay@gmail.com Scaffold view metrics overrides (flutter/flutter#192764)
2026-10-13 kevmoo@users.noreply.github.com [web] Add SemanticsRole.listBox and SemanticsRole.option (flutter/flutter#192971)
2026-10-13 15619084+vashworth@users.noreply.github.com Pin mac_unopt to macOS 15 (flutter/flutter#194254)
2026-10-13 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#194257)
2026-10-12 engine-flutter-autoroll@skia.org Roll Skia from 17f6986c226c to 0e5d8d1be81b (4 revisions) (flutter/flutter#194249)
2026-10-12 97480502+b-luk@users.noreply.github.com Make DisplayLists' use of DlPaint, SkPaint, and impeller::Paint agree on the default isAntiAlias (flutter/flutter#193939)

If this roll has caused a breakage, revert this CL and set the roller
...
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-flutter__flutter that referenced this pull request Oct 17, 2026
…rns on (flutter#194393)

Follow-up to flutter#194109.

When the app enables semantics itself, `didReceiveSemanticsUpdate`
removed the placeholder right away. If a drag that started on the
placeholder was still going on, removing its target could lose the
drag's `pointerup`, which is the same failure as
flutter#194104.

This PR replaces `SemanticsHelper.dispose()` with
`retirePlaceholders()`. On mobile, `MobileSemanticsEnabler` tracks
whether a pointer or touch gesture is in progress. If one is, removal
waits for the next
`pointerup`/`pointercancel`/`touchend`/`touchcancel`/`click`, the same
way the 20-attempt path already does. Otherwise it removes the
placeholder immediately. Desktop is unchanged, since its placeholder is
offscreen and can't be the target of a gesture.

Part of flutter#194104
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…r#194109)

Fixes flutter#194104

## Problem
On mobile, the engine covers each view with a semantics placeholder and
removes it after 20 events that do not activate a screen reader. On
non-WebKit browsers it removed the placeholder on the very next event,
usually a `pointermove` in the middle of a drag. That placeholder is the
drag's target, and when the page lets the browser pan and cancels
`touchmove`, Chrome on Android stops delivering the rest of the drag,
including its `pointerup`, so the framework keeps the pointer down
forever.

## Fix
Remove the placeholder only on `touchend`, `pointerup`, or `click`, once
the gesture that targets it has ended, on every browser engine. WebKit
has used this rule since the placeholder was added. Accessibility was
already given up on, so the only change is that the placeholder goes
away when the finger lifts instead of mid-gesture.

## Demo
On an Android phone in Chrome, reload the page, do one long, slow drag
on the list, and lift the finger.
Before, "Pointers down" stays at 1:
https://flutter-demo-77-before.web.app
After, "Pointers down" returns to 0 and the list is idle:
https://flutter-demo-77-after.web.app
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…rns on (flutter#194393)

Follow-up to flutter#194109.

When the app enables semantics itself, `didReceiveSemanticsUpdate`
removed the placeholder right away. If a drag that started on the
placeholder was still going on, removing its target could lose the
drag's `pointerup`, which is the same failure as
flutter#194104.

This PR replaces `SemanticsHelper.dispose()` with
`retirePlaceholders()`. On mobile, `MobileSemanticsEnabler` tracks
whether a pointer or touch gesture is in progress. If one is, removal
waits for the next
`pointerup`/`pointercancel`/`touchend`/`touchcancel`/`click`, the same
way the 20-attempt path already does. Otherwise it removes the
placeholder immediately. Desktop is unchanged, since its placeholder is
offscreen and can't be the target of a gesture.

Part of flutter#194104
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[web][a11y] On Android, removing the semantics placeholder mid-touch can leave a Flutter pointer down forever

2 participants