[go: nahoru, domu]

Skip to content

Commit

Permalink
[Linux][A11y] use ATK_ROLE_PASSWORD_TEXT for obscured text (flutter#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnurmi committed May 12, 2022
1 parent 14871f1 commit 12b4baf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions shell/platform/linux/fl_accessible_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ static AtkRole fl_accessible_node_get_role(AtkObject* accessible) {
if ((self->flags & kFlutterSemanticsFlagIsSlider) != 0) {
return ATK_ROLE_SLIDER;
}
if ((self->flags & kFlutterSemanticsFlagIsTextField) != 0 &&
(self->flags & kFlutterSemanticsFlagIsObscured) != 0) {
return ATK_ROLE_PASSWORD_TEXT;
}
if ((self->flags & kFlutterSemanticsFlagIsTextField) != 0) {
return ATK_ROLE_TEXT;
}
Expand Down
8 changes: 8 additions & 0 deletions shell/platform/linux/fl_accessible_node_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ TEST(FlAccessibleNodeTest, GetRole) {
fl_accessible_node_set_flags(node, static_cast<FlutterSemanticsFlag>(
kFlutterSemanticsFlagHasToggledState));
EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_TOGGLE_BUTTON);

fl_accessible_node_set_flags(node, kFlutterSemanticsFlagIsTextField);
EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_TEXT);

fl_accessible_node_set_flags(
node, static_cast<FlutterSemanticsFlag>(kFlutterSemanticsFlagIsTextField |
kFlutterSemanticsFlagIsObscured));
EXPECT_EQ(atk_object_get_role(ATK_OBJECT(node)), ATK_ROLE_PASSWORD_TEXT);
}

// Checks Flutter actions are mapped to the appropriate ATK actions.
Expand Down

0 comments on commit 12b4baf

Please sign in to comment.