[web] Use pointer-events: auto for non-interactive leaf semantics nodes#183077
Conversation
| if (semanticRole!.acceptsPointerEvents) { | ||
| element.style.pointerEvents = 'all'; | ||
| } else { | ||
| } else if (hitTestBehavior == ui.SemanticsHitTestBehavior.transparent || hasChildren) { | ||
| element.style.pointerEvents = 'none'; | ||
| } else { | ||
| element.style.pointerEvents = 'auto'; | ||
| } |
There was a problem hiding this comment.
Mixing conditions like this doesn't seem ideal. Can we fully rely on hitTestBehavior?
| if (semanticRole!.acceptsPointerEvents) { | |
| element.style.pointerEvents = 'all'; | |
| } else { | |
| } else if (hitTestBehavior == ui.SemanticsHitTestBehavior.transparent || hasChildren) { | |
| element.style.pointerEvents = 'none'; | |
| } else { | |
| element.style.pointerEvents = 'auto'; | |
| } | |
| switch (hitTestBehavior) { | |
| case ui.SemanticsHitTestBehavior.opaque: | |
| element.style.pointerEvents = 'all'; | |
| case ui.SemanticsHitTestBehavior.transparent: | |
| // The framework should automatically set containers to `transparent`. | |
| element.style.pointerEvents = 'none'; | |
| case ui.SemanticsHitTestBehavior.defer: | |
| element.style.pointerEvents = 'auto'; | |
| } |
There was a problem hiding this comment.
This is ideal, but this may be a bit hard to implement though.
There was a problem hiding this comment.
The switch approach is cleaner, but it requires the framework to explicitly set transparent on all container nodes.
Today, only 3 places set hitTestBehavior to a non-defer value: platform_view.dart (transparent) and dialog.dart/bottom_sheet.dart (opaque). All other container nodes stay at the default defer. So a pure switch would assign pointer-events: auto to containers too, breaking the assumption that children handle their own events.
There was a problem hiding this comment.
since this is a web corner case, I think will be better to handle internally in web engine.
There was a problem hiding this comment.
Got it, thanks for clarifying.
Is it fair to say that opaque and transparent values from the framework should be 100% respected, and the engine should only make a decision within the defer case?
i.e. something like this with clear separation:
switch (hitTestBehavior) {
case ui.SemanticsHitTestBehavior.opaque:
// Repect the framework's request for `opaque`.
element.style.pointerEvents = 'all';
return;
case ui.SemanticsHitTestBehavior.transparent:
// Repect the framework's request for `transparent`.
element.style.pointerEvents = 'none';
return;
case ui.SemanticsHitTestBehavior.defer:
// The engine should do a best effort to decide below.
break;
}
if (semanticRole!.acceptsPointerEvents) {
element.style.pointerEvents = 'all';
} else if (hasChildren) {
element.style.pointerEvents = 'none';
} else {
element.style.pointerEvents = 'auto';
}There was a problem hiding this comment.
Another thing is, in the past, when acceptsPointerEvents returns false, there was an expectation that pointer-events would be set to none, but now it's being set to auto in some cases. This could break things like platform views:
There was a problem hiding this comment.
Oh never mind, platform views are configured as transparent at the framework level:
There was a problem hiding this comment.
Code Review
This pull request refactors the pointer-events assignment logic within the semantics engine to correctly handle non-interactive leaf semantics nodes. Previously, these nodes were assigned pointer-events: none, which caused issues with OverlayPortal content not receiving pointer events. The updated logic now assigns pointer-events: auto to these nodes, allowing the browser's native z-index stacking to determine hit testing. The change also clarifies the three-tier assignment of pointer-events (all, none, auto) based on interactivity, SemanticsHitTestBehavior, and node structure. Comprehensive test cases have been added and updated to validate these new behaviors across various scenarios, including opaque/transparent containers, platform views, and non-interactive leaf nodes.
mdebbar
left a comment
There was a problem hiding this comment.
My comments are merely suggestions, but shouldn't block this PR!
Roll Flutter from d3dd7744e81f to d18214307703 (33 revisions) flutter/flutter@d3dd774...d182143 2026-03-06 engine-flutter-autoroll@skia.org Roll Packages from 8d5c5cd to fe3de64 (2 revisions) (flutter/flutter#183308) 2026-03-06 engine-flutter-autoroll@skia.org Roll Dart SDK from 1b51451cdb99 to 7c7c1e3d024d (2 revisions) (flutter/flutter#183294) 2026-03-06 engine-flutter-autoroll@skia.org Roll Dart SDK from 9ac06cdd1801 to 1b51451cdb99 (9 revisions) (flutter/flutter#183289) 2026-03-06 jacksongardner@google.com Add GitHub workflows to assist with release tasks (flutter/flutter#181978) 2026-03-06 flar@google.com [Impeller] Fix new convex path shadow generation in perspective (flutter/flutter#183187) 2026-03-06 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#183178) 2026-03-05 ishaquehassan@gmail.com fix: use double quotes in settings.gradle.kts template (flutter/flutter#183081) 2026-03-05 victorsanniay@gmail.com Add fallbackColor for PredictiveBackPageTransitionBuilder and PredictiveBackFullscreenPageTransitionBuilder (flutter/flutter#182690) 2026-03-05 97480502+b-luk@users.noreply.github.com Simplify TesterContextGLES (multithreading logic not needed), and enable some tests that now pass (flutter/flutter#183250) 2026-03-05 engine-flutter-autoroll@skia.org Roll Skia from a94df1cdabb0 to a69ef43650ee (14 revisions) (flutter/flutter#183280) 2026-03-05 matt.kosarek@canonical.com Windowing implementation of `showDialog` that uses a native desktop window to display the content (flutter/flutter#181861) 2026-03-05 15619084+vashworth@users.noreply.github.com Build CocoaPod plugin frameworks for Add to App FlutterPluginRegistrant (flutter/flutter#183239) 2026-03-05 jason-simmons@users.noreply.github.com Extend the Linux web_skwasm_tests_1 timeout to 45 minutes (flutter/flutter#183247) 2026-03-05 liama@google.com Update Dart to 3.12 beta 2 (flutter/flutter#183251) 2026-03-05 116356835+AbdeMohlbi@users.noreply.github.com Replace the rest of the references to `flutter/engine` with `flutter/flutter` (flutter/flutter#182938) 2026-03-05 codefu@google.com chore: convert android_verified_input to pub-workspace (flutter/flutter#183175) 2026-03-05 victorsanniay@gmail.com Add await to flutter_test callsites (flutter/flutter#182983) 2026-03-05 okorohelijah@google.com [iOS] Skip gesture recognizer reset workaround on iOS 26+ (flutter/flutter#183186) 2026-03-05 okorohelijah@google.com Add warning for plugins not migrated to UIScene (flutter/flutter#182826) 2026-03-05 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from JJw5EJ87vLGqFVl4h... to 8ay15_eQOEgPHCypm... (flutter/flutter#183255) 2026-03-05 engine-flutter-autoroll@skia.org Roll Skia from ada0b7628c79 to a94df1cdabb0 (2 revisions) (flutter/flutter#183249) 2026-03-05 engine-flutter-autoroll@skia.org Roll Packages from 82baf93 to 8d5c5cd (2 revisions) (flutter/flutter#183269) 2026-03-05 36861262+QuncCccccc@users.noreply.github.com Add `UnlabaledLeafNodeEvaluation` (flutter/flutter#182872) 2026-03-04 34871572+gmackall@users.noreply.github.com Re-specify the ndk version in various test apps, to prevent ndk download (flutter/flutter#183134) 2026-03-04 nate.w5687@gmail.com Eliminate rebuilds for Scaffold FAB animation (flutter/flutter#182331) 2026-03-04 43498643+mkucharski17@users.noreply.github.com Add Michal Kucharski to AUTHORS (flutter/flutter#182366) 2026-03-04 jacksongardner@google.com Merge changelog from 3.41.4 stable. (flutter/flutter#183243) 2026-03-04 codedoctor@linwood.dev Allow stylus support on windows (flutter/flutter#165323) 2026-03-04 737941+loic-sharma@users.noreply.github.com Fix docs on SingletonFlutterWindow.supportsShowingSystemContextMenu (flutter/flutter#183142) 2026-03-04 engine-flutter-autoroll@skia.org Roll Packages from 9083bc9 to 82baf93 (5 revisions) (flutter/flutter#183240) 2026-03-04 11901536+romaingyh@users.noreply.github.com Fixes FocusHighlightMode on Android when typing in software keyboard (flutter/flutter#180753) 2026-03-04 97480502+b-luk@users.noreply.github.com Make compileShader() retry without sksl if it fails with sksl. (flutter/flutter#183146) 2026-03-04 zhongliu88889@gmail.com [web] Use pointer-events: auto for non-interactive leaf semantics nodes (flutter/flutter#183077) 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 bmparr@google.com,stuartmorgan@google.com 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: ...
…es (flutter#183077) Fixes flutter#182493 **Problem** When semantics are enabled, `OverlayPortal` overlay content cannot receive pointer events. Clicks pass through the overlay to the widget underneath because every non-interactive semantics DOM node was assigned `pointer-events: none`, bypassing the browser's z-index stacking order. **Fix** Non-interactive leaf semantics nodes now use `pointer-events: auto` instead of `none`. This delegates hit testing to the browser's native z-index stacking, so higher-z-index overlays naturally intercept events. Containers keep `none` (children handle their own events), and explicit `transparent` nodes (e.g. platform views) also keep `none`. **Demo** Before change https://flutter-demo-13-before.web.app After change https://flutter-demo-13-afte.web.app Steps: click "Press to show/hide tooltip" → click the yellow tooltip box. Before: toggles the button behind it. A fter: click lands on the overlay.
…r#11191) Roll Flutter from d3dd7744e81f to d18214307703 (33 revisions) flutter/flutter@d3dd774...d182143 2026-03-06 engine-flutter-autoroll@skia.org Roll Packages from 8d5c5cd to fe3de64 (2 revisions) (flutter/flutter#183308) 2026-03-06 engine-flutter-autoroll@skia.org Roll Dart SDK from 1b51451cdb99 to 7c7c1e3d024d (2 revisions) (flutter/flutter#183294) 2026-03-06 engine-flutter-autoroll@skia.org Roll Dart SDK from 9ac06cdd1801 to 1b51451cdb99 (9 revisions) (flutter/flutter#183289) 2026-03-06 jacksongardner@google.com Add GitHub workflows to assist with release tasks (flutter/flutter#181978) 2026-03-06 flar@google.com [Impeller] Fix new convex path shadow generation in perspective (flutter/flutter#183187) 2026-03-06 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#183178) 2026-03-05 ishaquehassan@gmail.com fix: use double quotes in settings.gradle.kts template (flutter/flutter#183081) 2026-03-05 victorsanniay@gmail.com Add fallbackColor for PredictiveBackPageTransitionBuilder and PredictiveBackFullscreenPageTransitionBuilder (flutter/flutter#182690) 2026-03-05 97480502+b-luk@users.noreply.github.com Simplify TesterContextGLES (multithreading logic not needed), and enable some tests that now pass (flutter/flutter#183250) 2026-03-05 engine-flutter-autoroll@skia.org Roll Skia from a94df1cdabb0 to a69ef43650ee (14 revisions) (flutter/flutter#183280) 2026-03-05 matt.kosarek@canonical.com Windowing implementation of `showDialog` that uses a native desktop window to display the content (flutter/flutter#181861) 2026-03-05 15619084+vashworth@users.noreply.github.com Build CocoaPod plugin frameworks for Add to App FlutterPluginRegistrant (flutter/flutter#183239) 2026-03-05 jason-simmons@users.noreply.github.com Extend the Linux web_skwasm_tests_1 timeout to 45 minutes (flutter/flutter#183247) 2026-03-05 liama@google.com Update Dart to 3.12 beta 2 (flutter/flutter#183251) 2026-03-05 116356835+AbdeMohlbi@users.noreply.github.com Replace the rest of the references to `flutter/engine` with `flutter/flutter` (flutter/flutter#182938) 2026-03-05 codefu@google.com chore: convert android_verified_input to pub-workspace (flutter/flutter#183175) 2026-03-05 victorsanniay@gmail.com Add await to flutter_test callsites (flutter/flutter#182983) 2026-03-05 okorohelijah@google.com [iOS] Skip gesture recognizer reset workaround on iOS 26+ (flutter/flutter#183186) 2026-03-05 okorohelijah@google.com Add warning for plugins not migrated to UIScene (flutter/flutter#182826) 2026-03-05 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from JJw5EJ87vLGqFVl4h... to 8ay15_eQOEgPHCypm... (flutter/flutter#183255) 2026-03-05 engine-flutter-autoroll@skia.org Roll Skia from ada0b7628c79 to a94df1cdabb0 (2 revisions) (flutter/flutter#183249) 2026-03-05 engine-flutter-autoroll@skia.org Roll Packages from 82baf93 to 8d5c5cd (2 revisions) (flutter/flutter#183269) 2026-03-05 36861262+QuncCccccc@users.noreply.github.com Add `UnlabaledLeafNodeEvaluation` (flutter/flutter#182872) 2026-03-04 34871572+gmackall@users.noreply.github.com Re-specify the ndk version in various test apps, to prevent ndk download (flutter/flutter#183134) 2026-03-04 nate.w5687@gmail.com Eliminate rebuilds for Scaffold FAB animation (flutter/flutter#182331) 2026-03-04 43498643+mkucharski17@users.noreply.github.com Add Michal Kucharski to AUTHORS (flutter/flutter#182366) 2026-03-04 jacksongardner@google.com Merge changelog from 3.41.4 stable. (flutter/flutter#183243) 2026-03-04 codedoctor@linwood.dev Allow stylus support on windows (flutter/flutter#165323) 2026-03-04 737941+loic-sharma@users.noreply.github.com Fix docs on SingletonFlutterWindow.supportsShowingSystemContextMenu (flutter/flutter#183142) 2026-03-04 engine-flutter-autoroll@skia.org Roll Packages from 9083bc9 to 82baf93 (5 revisions) (flutter/flutter#183240) 2026-03-04 11901536+romaingyh@users.noreply.github.com Fixes FocusHighlightMode on Android when typing in software keyboard (flutter/flutter#180753) 2026-03-04 97480502+b-luk@users.noreply.github.com Make compileShader() retry without sksl if it fails with sksl. (flutter/flutter#183146) 2026-03-04 zhongliu88889@gmail.com [web] Use pointer-events: auto for non-interactive leaf semantics nodes (flutter/flutter#183077) 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 bmparr@google.com,stuartmorgan@google.com 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: ...
…es (flutter#183077) Fixes flutter#182493 **Problem** When semantics are enabled, `OverlayPortal` overlay content cannot receive pointer events. Clicks pass through the overlay to the widget underneath because every non-interactive semantics DOM node was assigned `pointer-events: none`, bypassing the browser's z-index stacking order. **Fix** Non-interactive leaf semantics nodes now use `pointer-events: auto` instead of `none`. This delegates hit testing to the browser's native z-index stacking, so higher-z-index overlays naturally intercept events. Containers keep `none` (children handle their own events), and explicit `transparent` nodes (e.g. platform views) also keep `none`. **Demo** Before change https://flutter-demo-13-before.web.app After change https://flutter-demo-13-afte.web.app Steps: click "Press to show/hide tooltip" → click the yellow tooltip box. Before: toggles the button behind it. A fter: click lands on the overlay.
…r#11191) Roll Flutter from d3dd7744e81f to d18214307703 (33 revisions) flutter/flutter@d3dd774...d182143 2026-03-06 engine-flutter-autoroll@skia.org Roll Packages from 8d5c5cd to fe3de64 (2 revisions) (flutter/flutter#183308) 2026-03-06 engine-flutter-autoroll@skia.org Roll Dart SDK from 1b51451cdb99 to 7c7c1e3d024d (2 revisions) (flutter/flutter#183294) 2026-03-06 engine-flutter-autoroll@skia.org Roll Dart SDK from 9ac06cdd1801 to 1b51451cdb99 (9 revisions) (flutter/flutter#183289) 2026-03-06 jacksongardner@google.com Add GitHub workflows to assist with release tasks (flutter/flutter#181978) 2026-03-06 flar@google.com [Impeller] Fix new convex path shadow generation in perspective (flutter/flutter#183187) 2026-03-06 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#183178) 2026-03-05 ishaquehassan@gmail.com fix: use double quotes in settings.gradle.kts template (flutter/flutter#183081) 2026-03-05 victorsanniay@gmail.com Add fallbackColor for PredictiveBackPageTransitionBuilder and PredictiveBackFullscreenPageTransitionBuilder (flutter/flutter#182690) 2026-03-05 97480502+b-luk@users.noreply.github.com Simplify TesterContextGLES (multithreading logic not needed), and enable some tests that now pass (flutter/flutter#183250) 2026-03-05 engine-flutter-autoroll@skia.org Roll Skia from a94df1cdabb0 to a69ef43650ee (14 revisions) (flutter/flutter#183280) 2026-03-05 matt.kosarek@canonical.com Windowing implementation of `showDialog` that uses a native desktop window to display the content (flutter/flutter#181861) 2026-03-05 15619084+vashworth@users.noreply.github.com Build CocoaPod plugin frameworks for Add to App FlutterPluginRegistrant (flutter/flutter#183239) 2026-03-05 jason-simmons@users.noreply.github.com Extend the Linux web_skwasm_tests_1 timeout to 45 minutes (flutter/flutter#183247) 2026-03-05 liama@google.com Update Dart to 3.12 beta 2 (flutter/flutter#183251) 2026-03-05 116356835+AbdeMohlbi@users.noreply.github.com Replace the rest of the references to `flutter/engine` with `flutter/flutter` (flutter/flutter#182938) 2026-03-05 codefu@google.com chore: convert android_verified_input to pub-workspace (flutter/flutter#183175) 2026-03-05 victorsanniay@gmail.com Add await to flutter_test callsites (flutter/flutter#182983) 2026-03-05 okorohelijah@google.com [iOS] Skip gesture recognizer reset workaround on iOS 26+ (flutter/flutter#183186) 2026-03-05 okorohelijah@google.com Add warning for plugins not migrated to UIScene (flutter/flutter#182826) 2026-03-05 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from JJw5EJ87vLGqFVl4h... to 8ay15_eQOEgPHCypm... (flutter/flutter#183255) 2026-03-05 engine-flutter-autoroll@skia.org Roll Skia from ada0b7628c79 to a94df1cdabb0 (2 revisions) (flutter/flutter#183249) 2026-03-05 engine-flutter-autoroll@skia.org Roll Packages from 82baf93 to 8d5c5cd (2 revisions) (flutter/flutter#183269) 2026-03-05 36861262+QuncCccccc@users.noreply.github.com Add `UnlabaledLeafNodeEvaluation` (flutter/flutter#182872) 2026-03-04 34871572+gmackall@users.noreply.github.com Re-specify the ndk version in various test apps, to prevent ndk download (flutter/flutter#183134) 2026-03-04 nate.w5687@gmail.com Eliminate rebuilds for Scaffold FAB animation (flutter/flutter#182331) 2026-03-04 43498643+mkucharski17@users.noreply.github.com Add Michal Kucharski to AUTHORS (flutter/flutter#182366) 2026-03-04 jacksongardner@google.com Merge changelog from 3.41.4 stable. (flutter/flutter#183243) 2026-03-04 codedoctor@linwood.dev Allow stylus support on windows (flutter/flutter#165323) 2026-03-04 737941+loic-sharma@users.noreply.github.com Fix docs on SingletonFlutterWindow.supportsShowingSystemContextMenu (flutter/flutter#183142) 2026-03-04 engine-flutter-autoroll@skia.org Roll Packages from 9083bc9 to 82baf93 (5 revisions) (flutter/flutter#183240) 2026-03-04 11901536+romaingyh@users.noreply.github.com Fixes FocusHighlightMode on Android when typing in software keyboard (flutter/flutter#180753) 2026-03-04 97480502+b-luk@users.noreply.github.com Make compileShader() retry without sksl if it fails with sksl. (flutter/flutter#183146) 2026-03-04 zhongliu88889@gmail.com [web] Use pointer-events: auto for non-interactive leaf semantics nodes (flutter/flutter#183077) 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 bmparr@google.com,stuartmorgan@google.com 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: ...
Fixes #182493
Problem
When semantics are enabled,
OverlayPortaloverlay content cannot receive pointer events. Clicks pass through the overlay to the widget underneath because every non-interactive semantics DOM node was assignedpointer-events: none, bypassing the browser's z-index stacking order.Fix
Non-interactive leaf semantics nodes now use
pointer-events: autoinstead ofnone. This delegates hit testing to the browser's native z-index stacking, so higher-z-index overlays naturally intercept events. Containers keepnone(children handle their own events), and explicittransparentnodes (e.g. platform views) also keepnone.Demo
Before change
https://flutter-demo-13-before.web.app
After change
https://flutter-demo-13-afte.web.app
Steps: click "Press to show/hide tooltip" → click the yellow tooltip box.
Before: toggles the button behind it. A
fter: click lands on the overlay.