SemanticsNode#0
│ Rect.fromLTRB(0.0, 0.0, 1080.0, 2340.0)
│
└─SemanticsNode#1
│ Rect.fromLTRB(0.0, 0.0, 411.4, 891.4) scaled by 2.6x
│ textDirection: ltr
│
└─SemanticsNode#2
│ Rect.fromLTRB(0.0, 0.0, 411.4, 891.4)
│ sortKey: OrdinalSortKey#317df(order: 0.0)
│
└─SemanticsNode#3
│ Rect.fromLTRB(0.0, 0.0, 411.4, 891.4)
│ flags: scopesRoute
│
├─SemanticsNode#7
│ │ Rect.fromLTRB(0.0, 0.0, 411.4, 97.1)
│ │
│ └─SemanticsNode#8
│ Rect.fromLTRB(16.0, 51.1, 233.0, 87.1)
│ flags: isHeader, namesRoute
│ label: "Semantics Demo"
│ textDirection: ltr
│
├─SemanticsNode#4
│ │ merge boundary ⛔️
│ │ Rect.fromLTRB(16.0, 113.1, 395.4, 161.1)
│ │
│ ├─SemanticsNode#9
│ │ merged up ⬆️
│ │ Rect.fromLTRB(0.0, 8.5, 60.5, 39.5)
│ │ tags: []
│ │ label: "height"
│ │ textDirection: ltr
│ │ sortKey: OrdinalSortKey#dbfb4(name: "859212319", order: 0.0)
│ │
│ ├─SemanticsNode#5
│ │ merged up ⬆️
│ │ Rect.fromLTRB(0.0, 0.0, 379.4, 48.0)
│ │ actions: focus, setSelection, setText, tap
│ │ flags: isTextField, isFocused, hasEnabledState, isEnabled
│ │ label: "Room Height"
│ │ textDirection: ltr
│ │ sortKey: OrdinalSortKey#3e8c4(name: "859212319", order: 1.0)
│ │ text selection: [0, 0]
│ │ currentValueLength: 0
│ │
│ └─SemanticsNode#10
│ merged up ⬆️
│ Rect.fromLTRB(341.6, 8.5, 379.4, 39.5)
│ tags: []
│ label: "feet"
│ textDirection: ltr
│ sortKey: OrdinalSortKey#bbdd6(name: "859212319", order: 2.0)
│
└─SemanticsNode#6
Rect.fromLTRB(161.1, 161.1, 250.3, 209.1)
actions: focus, tap
flags: isButton, hasEnabledState, isEnabled, isFocusable
label: "Dump"
textDirection: ltr
thickness: 1.0
I/flutter ( 8407):
Description
When creating a
TextField(orTextFormField), there isn't a good way to merge the semantics of the prefix/suffix fields of anInputDecorator. If you do the obvious thing:Semantic Tree
Then the semantics label you get on Talkback when the field is focused is "Room Height", not "Room Height height feet" (or, more usefully: "Room Height prefix height suffix feet" or something similar).
This is probably a design choice because people often put controls in the suffix and prefix fields, but if those are text (via
prefixTextandsuffixText), then it seems like a good idea to merge their semantics somehow if there is aMergeSemanticsaround the text field.Below is a simple reproduction case. Also, if you uncomment the
container: true, then it merges in the prefix and suffix to the semantics nodes as expected, but Talkback doesn't read them, and you can no longer navigate to them (because they are merged in, which makes sense).There needs to be a way to merge in the semantics so that a suffix or prefix will be read, but without it appearing to be part of the user's text (in Talkback).
Semantic Tree with container:true
flutter doctor -v