Skip to content

[web] Don't remove the a11y placeholder mid-gesture when semantics turns on - #194393

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
mdebbar:defer-placeholder-removal-on-enable
Oct 16, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
mdebbar:defer-placeholder-removal-on-enable

Conversation

@mdebbar

@mdebbar mdebbar commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #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 #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 #194104

@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 14, 2026
@mdebbar
mdebbar marked this pull request as ready for review October 14, 2026 21:58
@mdebbar
mdebbar requested a review from flutter-zl October 14, 2026 21:58

@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 replaces the immediate disposal of semantics placeholders with a deferred retirement mechanism. On mobile platforms, if a touch or pointer gesture is in progress, placeholder removal is scheduled to occur only after the gesture ends, preventing lost pointer events. On desktop, placeholders are removed immediately. Feedback suggests resetting the _schedulePlaceholderRemoval flag to false once placeholders are removed to ensure proper state hygiene.

@mdebbar mdebbar added the CICD Run CI/CD label Oct 14, 2026

@flutter-zl flutter-zl 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.

LGTM. Verified on Android Chrome with a demo that calls ensureSemantics() mid-drag:
- Before (https://flutter-demo-03-before.web.app): the placeholder is removed during the drag and the list stops scrolling.
- After (https://flutter-demo-03-after.web.app): the placeholder is removed after the finger lifts and the drag scrolls normally.

@flutter-zl flutter-zl added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 15, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 15, 2026
@auto-submit

auto-submit Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/194393, because - The status or check suite Mac_arm64_verify_binaries has failed. Please fix the issues identified (or deflake) before re-applying this label.

  • The status or check suite Tree_analyze has failed. Please fix the issues identified (or deflake) before re-applying this label.

@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 16, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 16, 2026
@auto-submit

auto-submit Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/194393, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

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.

2 participants