Skip to content

Commit

Permalink
Consider more roles as text (flutter#38645)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaakovschectman authored Jan 5, 2023
1 parent 74861f3 commit 5bd90d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions third_party/accessibility/ax/ax_node_position_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ void AXPositionTest::SetUp() {
true);
text_field_.AddState(ax::mojom::State::kEditable);
text_field_.SetValue(TEXT_VALUE);
text_field_.SetName(TEXT_VALUE);
text_field_.AddIntListAttribute(
ax::mojom::IntListAttribute::kCachedLineStarts,
std::vector<int32_t>{0, 7});
Expand Down Expand Up @@ -1078,7 +1079,7 @@ TEST_F(AXPositionTest, GetMaxTextOffsetAndGetTextWithGeneratedContent) {
root_1.role = ax::mojom::Role::kRootWebArea;
root_1.child_ids = {text_field_2.id};

text_field_2.role = ax::mojom::Role::kTextField;
text_field_2.role = ax::mojom::Role::kGroup;
text_field_2.SetValue("3.14");
text_field_2.child_ids = {static_text_3.id, static_text_5.id};

Expand Down Expand Up @@ -1573,7 +1574,7 @@ TEST_F(AXPositionTest, AtStartAndEndOfLineInsideTextField) {

AXNodeData text_field_data_1;
text_field_data_1.id = 2;
text_field_data_1.role = ax::mojom::Role::kTextField;
text_field_data_1.role = ax::mojom::Role::kGroup;
// "kIsLineBreakingObject" and the "kEditable" state are not strictly
// necessary but are added for completeness.
text_field_data_1.AddBoolAttribute(
Expand Down Expand Up @@ -1613,7 +1614,7 @@ TEST_F(AXPositionTest, AtStartAndEndOfLineInsideTextField) {

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

text_field_4.role = ax::mojom::Role::kTextField;
text_field_4.role = ax::mojom::Role::kGroup;
text_field_4.child_ids = {generic_container_5.id};

generic_container_5.role = ax::mojom::Role::kGenericContainer;
Expand Down
2 changes: 1 addition & 1 deletion third_party/accessibility/ax/ax_range_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void AXRangeTest::SetUp() {
check_box2_.AddIntAttribute(ax::mojom::IntAttribute::kPreviousOnLineId,
check_box1_.id);

text_field_.role = ax::mojom::Role::kTextField;
text_field_.role = ax::mojom::Role::kGroup;
text_field_.AddState(ax::mojom::State::kEditable);
text_field_.SetValue(TEXT_FIELD);
text_field_.AddIntListAttribute(
Expand Down
3 changes: 3 additions & 0 deletions third_party/accessibility/ax/ax_role_properties.cc
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,9 @@ bool IsText(ax::mojom::Role role) {
case ax::mojom::Role::kInlineTextBox:
case ax::mojom::Role::kLineBreak:
case ax::mojom::Role::kStaticText:
case ax::mojom::Role::kTextField:
case ax::mojom::Role::kTextFieldWithComboBox:
case ax::mojom::Role::kLabelText:
return true;
default:
return false;
Expand Down

0 comments on commit 5bd90d6

Please sign in to comment.