Commit ee4b369d authored by Ionel Popescu's avatar Ionel Popescu Committed by Commit Bot

Update the aria role for datalist and its options to match the spec.

According to https://w3c.github.io/html-aam/#el-datalist the aria role for
datalist should be listbox (currently it is menu).

For datalist options according to https://w3c.github.io/html-aam/#el-option the aria
role should be option (currently it is menuitem).

The unit test is also updated to use the new aria roles.

Bug: 1011133
Change-Id: Ia3541067e3d8ada622c5c3776f3b1b0ce0a26c54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838997Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Commit-Queue: Ionel Popescu <iopopesc@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#706495}
parent 0882b0ee
...@@ -335,7 +335,7 @@ void AutofillPopupItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) { ...@@ -335,7 +335,7 @@ void AutofillPopupItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->SetName(base::JoinString(text, base::ASCIIToUTF16(" "))); node_data->SetName(base::JoinString(text, base::ASCIIToUTF16(" ")));
// Options are selectable. // Options are selectable.
node_data->role = ax::mojom::Role::kMenuItem; node_data->role = ax::mojom::Role::kListBoxOption;
node_data->AddBoolAttribute(ax::mojom::BoolAttribute::kSelected, node_data->AddBoolAttribute(ax::mojom::BoolAttribute::kSelected,
is_selected()); is_selected());
...@@ -849,7 +849,7 @@ AutofillPopupViewNativeViews::~AutofillPopupViewNativeViews() {} ...@@ -849,7 +849,7 @@ AutofillPopupViewNativeViews::~AutofillPopupViewNativeViews() {}
void AutofillPopupViewNativeViews::GetAccessibleNodeData( void AutofillPopupViewNativeViews::GetAccessibleNodeData(
ui::AXNodeData* node_data) { ui::AXNodeData* node_data) {
node_data->role = ax::mojom::Role::kMenu; node_data->role = ax::mojom::Role::kListBox;
// If controller_ is valid, then the view is expanded. // If controller_ is valid, then the view is expanded.
if (controller_) { if (controller_) {
node_data->AddState(ax::mojom::State::kExpanded); node_data->AddState(ax::mojom::State::kExpanded);
......
...@@ -174,7 +174,7 @@ TEST_F(AutofillPopupViewNativeViewsTest, AccessibilityTest) { ...@@ -174,7 +174,7 @@ TEST_F(AutofillPopupViewNativeViewsTest, AccessibilityTest) {
// Item 0. // Item 0.
ui::AXNodeData node_data_0; ui::AXNodeData node_data_0;
view()->GetRowsForTesting()[0]->GetAccessibleNodeData(&node_data_0); view()->GetRowsForTesting()[0]->GetAccessibleNodeData(&node_data_0);
EXPECT_EQ(ax::mojom::Role::kMenuItem, node_data_0.role); EXPECT_EQ(ax::mojom::Role::kListBoxOption, node_data_0.role);
EXPECT_EQ(1, node_data_0.GetIntAttribute(ax::mojom::IntAttribute::kPosInSet)); EXPECT_EQ(1, node_data_0.GetIntAttribute(ax::mojom::IntAttribute::kPosInSet));
EXPECT_EQ(3, node_data_0.GetIntAttribute(ax::mojom::IntAttribute::kSetSize)); EXPECT_EQ(3, node_data_0.GetIntAttribute(ax::mojom::IntAttribute::kSetSize));
EXPECT_TRUE( EXPECT_TRUE(
...@@ -194,7 +194,7 @@ TEST_F(AutofillPopupViewNativeViewsTest, AccessibilityTest) { ...@@ -194,7 +194,7 @@ TEST_F(AutofillPopupViewNativeViewsTest, AccessibilityTest) {
view()->GetRowsForTesting()[2]->GetAccessibleNodeData(&node_data_2); view()->GetRowsForTesting()[2]->GetAccessibleNodeData(&node_data_2);
EXPECT_EQ(2, node_data_2.GetIntAttribute(ax::mojom::IntAttribute::kPosInSet)); EXPECT_EQ(2, node_data_2.GetIntAttribute(ax::mojom::IntAttribute::kPosInSet));
EXPECT_EQ(3, node_data_2.GetIntAttribute(ax::mojom::IntAttribute::kSetSize)); EXPECT_EQ(3, node_data_2.GetIntAttribute(ax::mojom::IntAttribute::kSetSize));
EXPECT_EQ(ax::mojom::Role::kMenuItem, node_data_2.role); EXPECT_EQ(ax::mojom::Role::kListBoxOption, node_data_2.role);
EXPECT_FALSE( EXPECT_FALSE(
node_data_2.GetBoolAttribute(ax::mojom::BoolAttribute::kSelected)); node_data_2.GetBoolAttribute(ax::mojom::BoolAttribute::kSelected));
...@@ -203,7 +203,7 @@ TEST_F(AutofillPopupViewNativeViewsTest, AccessibilityTest) { ...@@ -203,7 +203,7 @@ TEST_F(AutofillPopupViewNativeViewsTest, AccessibilityTest) {
view()->GetRowsForTesting()[3]->GetAccessibleNodeData(&node_data_3); view()->GetRowsForTesting()[3]->GetAccessibleNodeData(&node_data_3);
EXPECT_EQ(3, node_data_3.GetIntAttribute(ax::mojom::IntAttribute::kPosInSet)); EXPECT_EQ(3, node_data_3.GetIntAttribute(ax::mojom::IntAttribute::kPosInSet));
EXPECT_EQ(3, node_data_3.GetIntAttribute(ax::mojom::IntAttribute::kSetSize)); EXPECT_EQ(3, node_data_3.GetIntAttribute(ax::mojom::IntAttribute::kSetSize));
EXPECT_EQ(ax::mojom::Role::kMenuItem, node_data_3.role); EXPECT_EQ(ax::mojom::Role::kListBoxOption, node_data_3.role);
EXPECT_FALSE( EXPECT_FALSE(
node_data_3.GetBoolAttribute(ax::mojom::BoolAttribute::kSelected)); node_data_3.GetBoolAttribute(ax::mojom::BoolAttribute::kSelected));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment