-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Reland: Add framework-side hitTestBehavior support to Semantics (#178817) #179352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is a reland of flutter#177570, which was reverted in flutter#178744 due to test failures. The original PR introduced `hitTestBehavior` to the semantics framework but incorrectly applied `opaque` behavior to `ModalRoute`, which blocked platform views from receiving pointer events. Instead of making the entire modal opaque, we: 1. Keep `ModalRoute` without explicit `hitTestBehavior` (defaults to `defer`) 2. Make only the dialog/sheet content opaque (blocks clicks to barrier) 3. Platform views remain clickable because they're outside the opaque content boundary Fixes flutter#149001 Original PR: flutter#177570 Revert: flutter#178744
There was a problem hiding this comment.
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 adds hitTestBehavior support to the semantics framework to address an issue with pointer events on platform views within modal routes. The approach is to make dialog/sheet content opaque while ensuring platform views remain transparent for hit testing. My review identified a critical issue in packages/flutter/lib/src/widgets/routes.dart where changes appear to contradict the PR's stated goals and reintroduce a previously reverted bug. The other changes that plumb the new property through the framework and update tests seem correct, though some test adjustments may be needed once the primary issue is resolved.
| // To be sorted before the _modalBarrier. | ||
| return _modalScopeCache ??= Semantics( | ||
| sortKey: const OrdinalSortKey(0.0), | ||
| hitTestBehavior: ui.SemanticsHitTestBehavior.opaque, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description states: 'Keep ModalRoute without explicit hitTestBehavior (defaults to defer)'. However, this change sets hitTestBehavior to opaque on the Semantics widget within ModalRoute. This appears to contradict the stated goal of the PR and re-introduces a change from the original PR (#177570) which was reverted in #178744 because it blocked pointer events on platform views.
The new approach described in this PR is to make only the dialog/sheet content opaque, which is handled in material/dialog.dart and material/bottom_sheet.dart. This change seems to make the entire modal route opaque again.
To align with the PR description and avoid re-introducing the previous bug, this line should likely be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
| return Semantics( | ||
| scopesRoute: true, | ||
| explicitChildNodes: true, | ||
| hitTestBehavior: ui.SemanticsHitTestBehavior.opaque, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the change in ModalRoute, this change sets hitTestBehavior to opaque for RawDialogRoute. This contradicts the PR description's goal of not making the entire modal opaque and appears to re-introduce a change that was previously reverted. This line should likely be removed to prevent the bug that caused the original revert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
|
autosubmit label was removed for flutter/flutter/179352, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
chunhtai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ter#178817) (flutter#179352) This is a reland of flutter#178817, which was reverted in flutter#179100 due to test failures. The original PR introduced `hitTestBehavior` to the semantics framework but incorrectly applied `opaque` behavior to `ModalRoute`, which blocked platform views from receiving pointer events. Instead of making the entire modal opaque, we: 1. Keep `ModalRoute` without explicit `hitTestBehavior` (defaults to `defer`) 2. Make only the dialog/sheet content opaque (blocks clicks to barrier) 3. Platform views remain clickable because they're outside the opaque content boundary Fixes flutter#149001 Original PR: flutter#177570 Revert: flutter#178744
flutter/flutter@e25d71b...6e1aa82 2025-12-12 [email protected] Add documentation for what to do when bumping the minimum sdk version supported by flutter (flutter/flutter#179795) 2025-12-12 [email protected] Roll Skia from ee08571bbf67 to e66816c3645e (2 revisions) (flutter/flutter#179792) 2025-12-12 [email protected] Roll Packages from 36383d6 to 0ac7a03 (1 revision) (flutter/flutter#179793) 2025-12-12 [email protected] Roll Fuchsia Linux SDK from QssSL8DkxIbMvf89C... to fppT9ZrwbFx7iYrIh... (flutter/flutter#179785) 2025-12-12 [email protected] Roll Skia from 4251aa7454da to ee08571bbf67 (1 revision) (flutter/flutter#179783) 2025-12-12 [email protected] Roll Skia from 344ff9c41fb6 to 4251aa7454da (2 revisions) (flutter/flutter#179779) 2025-12-12 [email protected] Fix draggable scrollable sheet example drag speed is off (flutter/flutter#179179) 2025-12-12 [email protected] [ios][pv] accept/reject gesture based on hitTest (with new widget API) (flutter/flutter#179659) 2025-12-12 [email protected] Roll Skia from 7ad91f64b468 to 344ff9c41fb6 (1 revision) (flutter/flutter#179774) 2025-12-12 [email protected] [fuchsia] temporarily disable touch-input-test due to the flakiness (flutter/flutter#179747) 2025-12-12 [email protected] Roll Skia from 979b7ae09145 to 7ad91f64b468 (6 revisions) (flutter/flutter#179770) 2025-12-12 [email protected] Exit with code 1 when calling `flutter build` without arguments (flutter/flutter#175900) 2025-12-12 [email protected] [ Tool ] Assemble: "Improper" validation error when dealing with base64 encoded dart-define value (flutter/flutter#178737) 2025-12-12 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[ Analysis ] Added initial implementation of the `flutter_analyzer_plugin` (#175679)" (flutter/flutter#179766) 2025-12-11 [email protected] Add 3.38.5 changelog (flutter/flutter#179750) 2025-12-11 [email protected] Roll Dart SDK from 3d4b989bdc41 to 9a65db770758 (2 revisions) (flutter/flutter#179746) 2025-12-11 [email protected] fix: fresh install of windows support (flutter/flutter#179720) 2025-12-11 [email protected] [ Analysis ] Added initial implementation of the `flutter_analyzer_plugin` (flutter/flutter#175679) 2025-12-11 [email protected] Roll Skia from d570e2317110 to 979b7ae09145 (4 revisions) (flutter/flutter#179742) 2025-12-11 [email protected] chore: linux fuchsia tests are flaking (flutter/flutter#179744) 2025-12-11 [email protected] Roll Packages from 74a5a53 to 36383d6 (4 revisions) (flutter/flutter#179740) 2025-12-11 [email protected] Revert "Android implementation of content sizing" (flutter/flutter#179698) 2025-12-11 [email protected] [skia] Disable legacy image decoders (flutter/flutter#179277) 2025-12-11 [email protected] Roll Skia from deb0153719dd to d570e2317110 (2 revisions) (flutter/flutter#179734) 2025-12-11 [email protected] Roll Dart SDK from dbcb567e2432 to 3d4b989bdc41 (1 revision) (flutter/flutter#179733) 2025-12-11 [email protected] Roll Fuchsia Linux SDK from u5vxWTRT0HlxOP5_r... to QssSL8DkxIbMvf89C... (flutter/flutter#179729) 2025-12-11 [email protected] Roll Skia from 59c6cad539f7 to deb0153719dd (2 revisions) (flutter/flutter#179721) 2025-12-11 [email protected] Roll Dart SDK from 077062c5e515 to dbcb567e2432 (2 revisions) (flutter/flutter#179715) 2025-12-11 [email protected] Use kPreventOverdraw for arcs with overlapping stroke caps (flutter/flutter#179312) 2025-12-11 [email protected] Roll Skia from e61cc6d073fd to 59c6cad539f7 (22 revisions) (flutter/flutter#179714) 2025-12-10 [email protected] Reland: Add framework-side hitTestBehavior support to Semantics (#178817) (flutter/flutter#179352) If this roll has caused a breakage, revert this CL and stop the roller 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: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This is a reland of #178817, which was reverted in #179100 due to test failures.
The original PR introduced
hitTestBehaviorto the semantics framework but incorrectly appliedopaquebehavior toModalRoute, which blocked platform views from receiving pointer events.Instead of making the entire modal opaque, we:
ModalRoutewithout explicithitTestBehavior(defaults todefer)Fixes #149001
Original PR: #177570
Revert: #178744