Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5bd90d6

Browse files
Consider more roles as text (#38645)
1 parent 74861f3 commit 5bd90d6

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

third_party/accessibility/ax/ax_node_position_unittest.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ void AXPositionTest::SetUp() {
297297
true);
298298
text_field_.AddState(ax::mojom::State::kEditable);
299299
text_field_.SetValue(TEXT_VALUE);
300+
text_field_.SetName(TEXT_VALUE);
300301
text_field_.AddIntListAttribute(
301302
ax::mojom::IntListAttribute::kCachedLineStarts,
302303
std::vector<int32_t>{0, 7});
@@ -1078,7 +1079,7 @@ TEST_F(AXPositionTest, GetMaxTextOffsetAndGetTextWithGeneratedContent) {
10781079
root_1.role = ax::mojom::Role::kRootWebArea;
10791080
root_1.child_ids = {text_field_2.id};
10801081

1081-
text_field_2.role = ax::mojom::Role::kTextField;
1082+
text_field_2.role = ax::mojom::Role::kGroup;
10821083
text_field_2.SetValue("3.14");
10831084
text_field_2.child_ids = {static_text_3.id, static_text_5.id};
10841085

@@ -1573,7 +1574,7 @@ TEST_F(AXPositionTest, AtStartAndEndOfLineInsideTextField) {
15731574

15741575
AXNodeData text_field_data_1;
15751576
text_field_data_1.id = 2;
1576-
text_field_data_1.role = ax::mojom::Role::kTextField;
1577+
text_field_data_1.role = ax::mojom::Role::kGroup;
15771578
// "kIsLineBreakingObject" and the "kEditable" state are not strictly
15781579
// necessary but are added for completeness.
15791580
text_field_data_1.AddBoolAttribute(
@@ -1613,7 +1614,7 @@ TEST_F(AXPositionTest, AtStartAndEndOfLineInsideTextField) {
16131614

16141615
AXNodeData text_field_data_2;
16151616
text_field_data_2.id = 7;
1616-
text_field_data_2.role = ax::mojom::Role::kTextField;
1617+
text_field_data_2.role = ax::mojom::Role::kGroup;
16171618
// "kIsLineBreakingObject" and the "kEditable" state are not strictly
16181619
// necessary but are added for completeness.
16191620
text_field_data_2.AddBoolAttribute(
@@ -7567,7 +7568,7 @@ TEST_F(AXPositionTest, EmptyObjectReplacedByCharacterTextNavigation) {
75677568
inline_box_3.AddIntListAttribute(ax::mojom::IntListAttribute::kWordEnds,
75687569
std::vector<int32_t>{6});
75697570

7570-
text_field_4.role = ax::mojom::Role::kTextField;
7571+
text_field_4.role = ax::mojom::Role::kGroup;
75717572
text_field_4.child_ids = {generic_container_5.id};
75727573

75737574
generic_container_5.role = ax::mojom::Role::kGenericContainer;

third_party/accessibility/ax/ax_range_unittest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void AXRangeTest::SetUp() {
205205
check_box2_.AddIntAttribute(ax::mojom::IntAttribute::kPreviousOnLineId,
206206
check_box1_.id);
207207

208-
text_field_.role = ax::mojom::Role::kTextField;
208+
text_field_.role = ax::mojom::Role::kGroup;
209209
text_field_.AddState(ax::mojom::State::kEditable);
210210
text_field_.SetValue(TEXT_FIELD);
211211
text_field_.AddIntListAttribute(

third_party/accessibility/ax/ax_role_properties.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,9 @@ bool IsText(ax::mojom::Role role) {
687687
case ax::mojom::Role::kInlineTextBox:
688688
case ax::mojom::Role::kLineBreak:
689689
case ax::mojom::Role::kStaticText:
690+
case ax::mojom::Role::kTextField:
691+
case ax::mojom::Role::kTextFieldWithComboBox:
692+
case ax::mojom::Role::kLabelText:
690693
return true;
691694
default:
692695
return false;

0 commit comments

Comments
 (0)