Skip to content

[iOS a11y] Synchronize hit-test children when replacing semantics objects - #196439

Merged
auto-submit[bot] merged 8 commits into
flutter:masterfrom
DD20-dai:vo-touch-hit-order-fix
Nov 20, 2026
Merged

auto-submit[bot] merged 8 commits into
flutter:masterfrom
DD20-dai:vo-touch-hit-order-fix

Conversation

@DD20-dai

@DD20-dai DD20-dai commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Synchronize SemanticsObject.childrenInHitTestOrder when replacing a child in
children. A partial semantics update can change hasImplicitScrolling and
replace the native object without updating its parent. Traversal then refers to
the replacement, but touch hit testing still visits the detached old object whose
children have been cleared.

Coordinate traversal and hit-test replacement in ReplaceSemanticsObject,
saving the parent before detaching the old object. Hit-test children use mutable
backing storage and an identity-based in-place replacement helper, preserving a
hit-test order that differs from traversal order without copying the array per
replacement. The getter preserves immutable snapshots; touch hit testing reads
the backing storage directly. Leave absent and nil hit-test entries untouched. No public API changes, suppression, focus requests,
timers, diagnostic logging, or version updates are included.

Fixes #196438.

Our application-level before/after testing identified #195731 (upstream merge
commit 2e65ef92e4e951cdd448f1839786f87b0009058c) as the change introducing the
user-visible touch-exploration regression. Its container hit-test forwarding
exposes an existing omission in semantics-object replacement: the parent's
hit-test array is not synchronized. The omission predates #195731; the regression
attribution concerns the observable behavior, not the creation of the replacement
methods. This fixes touch exploration, not the implicit-scroll boundary stall
tracked in #192774.

Tests cover differing child orders, absent/nil hit-test entries, and
true/false/true scrollable-type changes in an update containing only the child.
Bridge tests also verify parent relationships, cleared child collections on
a retained old object, and continued touch hit testing. A unit test verifies snapshot preservation and
that replacement does not call the hit-test array setter.

All added and updated regression tests passed. Manual VoiceOver testing of
this revision also confirmed that touch exploration remains functional after
enabling implicit scrolling.

Local focused XCTest A/B: original implementation 5/7 pass (the two targeted
regressions fail); fixed implementation 7/7 pass. These runs used an existing
dependency-synced checkout at d9b77d26265; the three touched files have unchanged
upstream baselines at 9c427b5d7b1, onto which this patch is prepared.
This is not a claim that the entire engine suite or upstream presubmit is green.

Manual VoiceOver A/B recordings of the final minimal Dart sample on a physical
iPhone also show the regression and recovery: list items lose touch focus after
enabling implicit scrolling with the official cached engine, but remain
accessible with the locally patched engine. The Dart sample and geometry are
unchanged. The local verification engine includes diagnostic logging, which is
not part of this proposed patch.

No flutter/tests or website migration is needed for the proposed internal fix.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added platform-ios iOS applications specifically engine flutter/engine related. See also e: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) team-ios Owned by iOS platform team labels Nov 12, 2026
@DD20-dai
DD20-dai marked this pull request as ready for review November 12, 2026 11:16
@DD20-dai
DD20-dai requested a review from a team as a code owner November 12, 2026 11:16

@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 updates SemanticsObject to ensure that replacing a child node also updates its position in _childrenInHitTestOrder if present, and adds corresponding unit tests. The review feedback correctly points out a potential bug where a nil _childrenInHitTestOrder array would cause indexOfObjectIdenticalTo: to return 0 instead of NSNotFound in Objective-C, incorrectly triggering the replacement logic and setting the property to nil. It is recommended to explicitly check for nil before retrieving the index.

@LongCatIsLooong LongCatIsLooong 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.

Thanks for the fix (and also the bug report)! The changes make sense to me, but I think the logic for updating _childrenInHitTestOrder should live in ReplaceSemanticsObject instead of replaceChildAtIndex:

@DD20-dai
DD20-dai force-pushed the vo-touch-hit-order-fix branch from 1d3090f to 37adffb Compare November 17, 2026 04:35
@LongCatIsLooong LongCatIsLooong added the CICD Run CI/CD label Nov 17, 2026
@LouiseHsu
LouiseHsu self-requested a review November 17, 2026 19:45
LouiseHsu
LouiseHsu previously approved these changes Nov 17, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 18, 2026
@LongCatIsLooong LongCatIsLooong added the CICD Run CI/CD label Nov 18, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 18, 2026
@LongCatIsLooong

LongCatIsLooong commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

It looks like some tests added in this PR are failing here:
https://flutter-dashboard.appspot.com/#/presubmit?repo=flutter&pr=196439&sha=49ccd141c1b5271fed7d75419a772deb25cdb231&job=Mac%2520mac_ios_debug_unopt_sim_arm64

Example:

/../../../flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge_test.mm:297: error: -[AccessibilityBridgeTest testPartialScrollableTypeChangesClearRetainedOldObjectChildren] : ((oldList) == nil) failed: "<FlutterSemanticsObject: 0x108168a80>"
2026-11-17 20:13:22.145239-0800 IosUnitTests[38127:756004] [UIFocus] FlutterSemanticsScrollView implements focusItemsInRect: - caching for linear focus movement is limited as long as this view is on screen.
Test Case '-[AccessibilityBridgeTest testPartialScrollableTypeChangesClearRetainedOldObjectChildren]' failed (0.135 seconds).

@DD20-dai
DD20-dai dismissed stale reviews from LongCatIsLooong and LouiseHsu via 1a08f14 November 18, 2026 06:39
@DD20-dai

Copy link
Copy Markdown
Contributor Author

Thanks for flagging this. The failing assertion requires the old object to be deallocated at a specific point, which is separate from the touch hit-testing behavior these tests are intended to cover.

I've removed that assertion while keeping the checks for child ordering, parent relationships, and successful hit testing after replacement. The retained-old-object test still verifies that both child collections are cleared and that the old object can no longer hit the list item.

The production fix is unchanged. The five targeted tests passed locally.

@LongCatIsLooong LongCatIsLooong added the CICD Run CI/CD label Nov 18, 2026
@LongCatIsLooong LongCatIsLooong added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 18, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 19, 2026
@LongCatIsLooong LongCatIsLooong added the CICD Run CI/CD label Nov 19, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 19, 2026
@auto-submit

auto-submit Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

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

@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 19, 2026
@LongCatIsLooong LongCatIsLooong added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Nov 19, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 19, 2026
@auto-submit

auto-submit Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/196439, Failed to enqueue flutter/flutter/196439 with HTTP 400: Pull request Required status check "Check Code Freeze" is expected..

@LongCatIsLooong LongCatIsLooong added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 20, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Nov 20, 2026
Merged via the queue into flutter:master with commit d75d402 Nov 20, 2026
24 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 20, 2026
@LongCatIsLooong LongCatIsLooong added cp: beta cherry pick this pull request to beta release candidate branch cp: stable cherry pick this pull request to stable release candidate branch labels Nov 20, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Nov 20, 2026
Roll Flutter from e8cc6f3451b7 to b34b017b48ad (36 revisions)

flutter/flutter@e8cc6f3...b34b017

2026-11-20 [email protected] Fix OverflowBox dry layout when deferToChild overrides the constraints (flutter/flutter#196839)
2026-11-20 [email protected] Roll Dart SDK from f118f476ebce to 3b5f45d812f8 (1 revision) (flutter/flutter#197048)
2026-11-20 [email protected] [macOS] Register plugins in multiple_windows example (flutter/flutter#196068)
2026-11-20 [email protected] Roll Skia from 87027a9d4659 to a1edf5c2ea5c (1 revision) (flutter/flutter#197045)
2026-11-20 [email protected] Add highp directives to UberSDF to prevent overflow (flutter/flutter#196997)
2026-11-20 [email protected] [Impeller] Cap the Vulkan command pool recycler cache (flutter/flutter#194793)
2026-11-20 [email protected] Roll Skia from 12610b69511d to 87027a9d4659 (4 revisions) (flutter/flutter#197037)
2026-11-20 [email protected] [macOS] Unregister nil binary message handlers (flutter/flutter#193672)
2026-11-20 [email protected] Roll Dart SDK from b803c3ec01de to f118f476ebce (2 revisions) (flutter/flutter#197034)
2026-11-20 [email protected] Roll Skia from 2f1436ba8e64 to 12610b69511d (3 revisions) (flutter/flutter#197030)
2026-11-20 [email protected] [Android] Do not use the HCPP external view embedder from its platform tasks (flutter/flutter#196490)
2026-11-20 [email protected] Roll Dart SDK from 849e17ad3ae6 to b803c3ec01de (1 revision) (flutter/flutter#197012)
2026-11-20 [email protected] [iOS a11y] Synchronize hit-test children when replacing semantics objects (flutter/flutter#196439)
2026-11-20 [email protected] Sync CHANGELOG.md from stable (flutter/flutter#197019)
2026-11-19 [email protected] [flutter_tools] Reland "Extract Windows archives using native tar" (flutter/flutter#193515)
2026-11-19 [email protected] [Reland][flutter_tools] Migrate lib/runner.dart off runInContext and overrides (flutter/flutter#196931)
2026-11-19 [email protected] Include assigned issues in Android incoming triage link (flutter/flutter#197008)
2026-11-19 [email protected] [Flutter GPU] Record on the UI thread, encode and submit on the raster thread (flutter/flutter#194882)
2026-11-19 [email protected] Add Pixel 7 Pro Impeller benchmarks without fixed-performance mode (flutter/flutter#197010)
2026-11-19 [email protected] Reduce time of uiscene_plugin_lifecycle_test_ios (flutter/flutter#196363)
2026-11-19 [email protected] [native assets] Respect Apple deployment targets (flutter/flutter#194146)
2026-11-19 [email protected] iOS: Represent platform view frames as FlutterPlatformViewFrames (flutter/flutter#196955)
2026-11-19 [email protected] Roll Skia from 0bf961e4ff05 to 2f1436ba8e64 (3 revisions) (flutter/flutter#196999)
2026-11-19 [email protected] [ios] Record OCMReject expectations before the stimulus in FlutterPluginAppLifeCycleDelegateTest (flutter/flutter#193011)
2026-11-19 [email protected] Fix post-monorepo doc rot in docs/infra and dev/bots/README.md (flutter/flutter#193010)
2026-11-19 [email protected] Roll Skia from c3567e170362 to 0bf961e4ff05 (4 revisions) (flutter/flutter#196994)
2026-11-19 [email protected] Close Linux popups when their parent loses focuses (flutter/flutter#196825)
2026-11-19 [email protected] Roll Packages from dca2e58 to 81b7c44 (6 revisions) (flutter/flutter#196992)
2026-11-19 [email protected] Roll Dart SDK from d8d40cf9c21b to 849e17ad3ae6 (1 revision) (flutter/flutter#196986)
2026-11-19 [email protected] Fix RouteObserver didPushNext not firing when routes are pushed synchronously (flutter/flutter#189057)
2026-11-19 [email protected] [Impeller] Reuse render targets on text shadow cache misses (flutter/flutter#194769)
2026-11-19 [email protected] Roll Skia from 81de64af9806 to c3567e170362 (3 revisions) (flutter/flutter#196982)
2026-11-19 [email protected] Reland: "Move macOS desktop builds to ThinLTO" (flutter/flutter#196928)
2026-11-19 [email protected] [Linux] Desynchronize the Wayland subsurface so frames don't redraw the GTK window (flutter/flutter#195287)
2026-11-19 [email protected] Roll Skia from 3dfb69d709c7 to 81de64af9806 (1 revision) (flutter/flutter#196975)
2026-11-19 [email protected] Update `ProxyAnimation.didStartListening` and `ProxyAnimation. didStopListening` to use dart's `Conditional member access` (flutter/flutter#195762)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
...
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 cp: beta cherry pick this pull request to beta release candidate branch cp: stable cherry pick this pull request to stable release candidate branch engine flutter/engine related. See also e: labels. platform-ios iOS applications specifically team-ios Owned by iOS platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] VoiceOver touch exploration loses scroll children after a partial semantics object replacement

3 participants