0

[UIA] Expose kLabelText as a UIA_Group instead of text

Before this change, the UIA Control tree had the following structure:
--text ""
----text "my label"

For a <label>my label</label>

This was making Narrator announce an empty text element ("blank") before
announcing "my label". This change modifies the UIA control type of our
internal kLabelText from UIA_TextControlType to UIA_GroupControlType.

I favored this role because the <label> element can contain 1+ text
nodes (e.g., <label><span>part 1</span><span>part 2</span></label>),
and therefore act as a group.

Fixed: 1521433
Change-Id: Ia1c5f5a4347c2ae9225759a284bacc2cdf40c0a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5232179
Reviewed-by: Jacques Newman <janewman@microsoft.com>
Commit-Queue: Benjamin Beaudry <benjamin.beaudry@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1252962}
This commit is contained in:
Benjamin Beaudry
2024-01-27 01:08:11 +00:00
committed by Chromium LUCI CQ
parent b623558ef4
commit bdcdba54d9
9 changed files with 30 additions and 28 deletions

@ -5,7 +5,7 @@ Document
++++Hyperlink Name='link'
++++++Text Name='link' IsControlElement=false
++++Text Name=' '
++++Text
++++Group IsControlElement=false
++++++Text Name='name: '
++++++Edit Name='name:'
++Edit Name='editable' Value.Value='focusable: oklink name: <newline>'
@ -14,7 +14,7 @@ Document
++++Hyperlink Name='link'
++++++Text Name='link' IsControlElement=false
++++Text Name=' '
++++Text
++++Group IsControlElement=false
++++++Text Name='name: '
++++++Edit Name='name:'
++Edit Name='not editable or focusable' Value.Value='focusable: oklink name: <newline>'
@ -23,7 +23,7 @@ Document
++++Hyperlink Name='link'
++++++Text Name='link' IsControlElement=false
++++Text Name=' '
++++Text
++++Group IsControlElement=false
++++++Text Name='name: '
++++++Edit Name='name:'
++Edit Name='not editable, img child'

@ -1,6 +1,6 @@
Document
++Text Name='Please enter pet name'
++Group
++++Text
++++Group IsControlElement=false
++++++Text Name='Pet name:'
++++Edit Name='Pet name:' IsRequiredForForm=true ControllerFor='Please enter pet name'

@ -1,5 +1,5 @@
Document
++Group IsControlElement=false
++++Text
++++Group IsControlElement=false
++++++Text Name='Choose a pokemon '
++++++ComboBox Name='Choose a pokemon' ExpandCollapse.ExpandCollapseState='LeafNode'

@ -2,9 +2,9 @@ Document
++Group IsControlElement=false
++++RadioButton Name='label ignored for radio button' SelectionItem.IsSelected=false
++++CheckBox Name='label ignored for checkbox' Toggle.ToggleState='Off'
++++Text Name='label exposed for radio button '
++++Group Name='label exposed for radio button '
++++++Text Name='label exposed for radio button '
++++++RadioButton Name='label exposed for radio button' SelectionItem.IsSelected=false
++++Text Name='label exposed for checkbox '
++++Group Name='label exposed for checkbox '
++++++Text Name='label exposed for checkbox '
++++++CheckBox Name='label exposed for checkbox' Toggle.ToggleState='Off'

@ -1,14 +1,14 @@
Document
++Group IsControlElement=false
++++Text
++++Group IsControlElement=false
++++++Text Name='l1'
++++Edit Name='l1'
++++Text
++++Group IsControlElement=false
++++++Text Name='l2'
++++Edit Name='l2' Value.Value='value'
++++Edit Name='l2'
++++Edit Name='l2' Value.Value='value *'
++++Text
++++Group IsControlElement=false
++++++Text Name='Email'
++++Group IsControlElement=false
++++Edit Name='Email'

@ -1,53 +1,53 @@
Document
++Group IsControlElement=false
++++Text
++++Group IsControlElement=false
++++++Text Name='Default: '
++++++Edit Name='Default:'
++++Text
++++Group IsControlElement=false
++++++Text Name='Button: '
++++++Button Name='Button:'
++++CheckBox Name='Checkbox:' Toggle.ToggleState='Off'
++++Text
++++Group IsControlElement=false
++++++Text Name='Color: '
++++++Button Name='Color:' Value.Value='0% red 0% green 0% blue'
++++Text
++++Group IsControlElement=false
++++++Text Name='Email: '
++++++Edit Name='Email:'
++++Text
++++Group IsControlElement=false
++++++Text Name='File: '
++++++Button Name='File:: No file chosen' Value.Value='No file chosen'
++++++++Button Name='Choose File' IsControlElement=false
++++Text
++++Group IsControlElement=false
++++++Text Name='Image: '
++++++Button Name='Image:'
++++++++Image
++++++++Text Name='Submit' IsControlElement=false
++++Text Name=' '
++++Text
++++Group IsControlElement=false
++++++Text Name='Number: '
++++++Spinner Name='Number:' RangeValue.IsReadOnly=false RangeValue.LargeChange=10.00 RangeValue.SmallChange=1.00 RangeValue.Maximum=0.00 RangeValue.Minimum=0.00 RangeValue.Value=0.00
++++Text
++++Group IsControlElement=false
++++++Text Name='Password: '
++++++Edit Name='Password:' IsPassword=true
++++RadioButton Name='Radio:' SelectionItem.IsSelected=false
++++Text
++++Group IsControlElement=false
++++++Text Name='Range: '
++++++Slider Name='Range:' RangeValue.IsReadOnly=false RangeValue.LargeChange=10.00 RangeValue.SmallChange=1.00 RangeValue.Maximum=100.00 RangeValue.Minimum=0.00 RangeValue.Value=50.00 Value.Value='50'
++++Text
++++Group IsControlElement=false
++++++Text Name='Reset: '
++++++Button Name='Reset:'
++++Text
++++Group IsControlElement=false
++++++Text Name='Search: '
++++++Edit Name='Search:'
++++Text
++++Group IsControlElement=false
++++++Text Name='Submit: '
++++++Button Name='Submit:'
++++Text
++++Group IsControlElement=false
++++++Text Name='Tel: '
++++++Edit Name='Tel:'
++++Text
++++Group IsControlElement=false
++++++Text Name='Text: '
++++++Edit Name='Text:'
++++Text
++++Group IsControlElement=false
++++++Text Name='Url: '
++++++Edit Name='Url:'

@ -1,5 +1,5 @@
Document
++Text
++Group IsControlElement=false
++++Text Name='Test label'
++Group Name='aria label'
++++Text Name='Generic container'

@ -1,4 +1,4 @@
Document
++Group IsControlElement=false
++++Text
++++Group IsControlElement=false
++++++Text Name='Label'

@ -1089,6 +1089,9 @@ AXPlatformNodeWin::UIARoleProperties AXPlatformNodeWin::GetUIARoleProperties() {
L"textbox"};
case ax::mojom::Role::kLabelText:
return {UIALocalizationStrategy::kSupply, UIA_GroupControlTypeId,
L"description"};
case ax::mojom::Role::kLegend:
return {UIALocalizationStrategy::kSupply, UIA_TextControlTypeId,
L"description"};
@ -7529,7 +7532,6 @@ bool AXPlatformNodeWin::IsUIAControl() const {
case ax::mojom::Role::kFooterAsNonLandmark:
case ax::mojom::Role::kHeader:
case ax::mojom::Role::kHeaderAsNonLandmark:
case ax::mojom::Role::kLabelText:
case ax::mojom::Role::kListBoxOption:
case ax::mojom::Role::kListItem:
// Treat the root of a MathML tree as content/control so that it is seen