Description
cc @yjbanov , @goderbauer
Consider the following semantics from the gallery's SnackBar demo below. Hit detection will move through the body before the snackbar widget. If the bounds of the semantics information in the body expand past the snackbar (which they always do), then hit testing will always succeed on either an element that is "below" the SnackBar or simply on empty space.
There are two general issues here:
-
accessibility hit detection shouldn't succeed on elements that are not focus-able. This prevents large semantic nodes with no actions/information from winning hit tests if they are incorrectly ordered before elements which should be "on top". I noticed this is an issue on Android, but I haven't checked on iOS yet.
-
The SnackBar semantic order should be changed some how (possibly with a sortKey) so that it is ordered before the Scaffold body semantics. Even with (1) fixed, you will still focus list items that are visually below the SnackBar unless it is ordered first.
I/flutter (29366): SemanticsNode#0
I/flutter (29366): │ Rect.fromLTRB(0.0, 0.0, 1080.0, 1794.0)
I/flutter (29366): │
I/flutter (29366): └─SemanticsNode#1
I/flutter (29366): │ Rect.fromLTRB(0.0, 0.0, 411.4, 683.4) scaled by 2.6x
I/flutter (29366): │ textDirection: ltr
I/flutter (29366): │
I/flutter (29366): └─SemanticsNode#48
I/flutter (29366): │ Rect.fromLTRB(0.0, 0.0, 411.4, 683.4)
I/flutter (29366): │ flags: scopesRoute
I/flutter (29366): │
I/flutter (29366): ├─SemanticsNode#55
I/flutter (29366): │ │ Rect.fromLTRB(0.0, 0.0, 411.4, 80.0)
I/flutter (29366): │ │
I/flutter (29366): │ ├─SemanticsNode#56
I/flutter (29366): │ │ Rect.fromLTRB(0.0, 24.0, 56.0, 80.0)
I/flutter (29366): │ │ actions: tap
I/flutter (29366): │ │ flags: isButton, hasEnabledState, isEnabled
I/flutter (29366): │ │ label: "Back"
I/flutter (29366): │ │ textDirection: ltr
I/flutter (29366): │ │
I/flutter (29366): │ └─SemanticsNode#57
I/flutter (29366): │ Rect.fromLTRB(72.0, 39.5, 159.0, 64.5)
I/flutter (29366): │ flags: isHeader, namesRoute
I/flutter (29366): │ label: "Snackbar"
I/flutter (29366): │ textDirection: ltr
I/flutter (29366): │
I/flutter (29366): ├─SemanticsNode#49
I/flutter (29366): │ │ Rect.fromLTRB(0.0, 80.0, 411.4, 683.4)
I/flutter (29366): │ │
I/flutter (29366): │ └─SemanticsNode#54
I/flutter (29366): │ │ Rect.fromLTRB(0.0, 0.0, 411.4, 603.4)
I/flutter (29366): │ │ scrollExtentMin: 0.0
I/flutter (29366): │ │ scrollPosition: 0.0
I/flutter (29366): │ │ scrollExtentMax: 0.0
I/flutter (29366): │ │
I/flutter (29366): │ ├─SemanticsNode#50
I/flutter (29366): │ │ Rect.fromLTRB(24.0, 36.0, 387.4, 84.0)
I/flutter (29366): │ │ label: "Snackbars provide lightweight feedback about an operation
I/flutter (29366): │ │ by showing a brief message at the bottom of the screen.
I/flutter (29366): │ │ Snackbars can contain an action."
I/flutter (29366): │ │ textDirection: ltr
I/flutter (29366): │ │
I/flutter (29366): │ ├─SemanticsNode#51
I/flutter (29366): │ │ Rect.fromLTRB(24.0, 108.0, 387.4, 156.0)
I/flutter (29366): │ │ label: "Snackbars should contain a single line of text directly
I/flutter (29366): │ │ related to the operation performed. They cannot contain icons."
I/flutter (29366): │ │ textDirection: ltr
I/flutter (29366): │ │
I/flutter (29366): │ ├─SemanticsNode#52
I/flutter (29366): │ │ Rect.fromLTRB(116.7, 180.0, 294.7, 216.0)
I/flutter (29366): │ │ actions: tap
I/flutter (29366): │ │ flags: isButton, hasEnabledState, isEnabled
I/flutter (29366): │ │ label: "SHOW A SNACKBAR"
I/flutter (29366): │ │ textDirection: ltr
I/flutter (29366): │ │
I/flutter (29366): │ └─SemanticsNode#53
I/flutter (29366): │ Rect.fromLTRB(24.0, 240.0, 387.4, 272.0)
I/flutter (29366): │ label: "By default snackbars automatically disappear after a few
I/flutter (29366): │ seconds "
I/flutter (29366): │ textDirection: ltr
I/flutter (29366): │
I/flutter (29366): └─SemanticsNode#58
I/flutter (29366): │ Rect.fromLTRB(0.0, 639.4, 411.4, 683.4)
I/flutter (29366): │ actions: scrollDown, scrollUp
I/flutter (29366): │ label: "This is snackbar #1."
I/flutter (29366): │ textDirection: ltr
I/flutter (29366): │
I/flutter (29366): └─SemanticsNode#59
I/flutter (29366): Rect.fromLTRB(312.4, 4.0, 411.4, 40.0)
I/flutter (29366): actions: tap
I/flutter (29366): flags: isButton, hasEnabledState, isEnabled
I/flutter (29366): label: "ACTION"
I/flutter (29366): textDirection: ltr