Commit 3d320d70 authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Swap order of title, url in ax name so that it matches the ax value

Copies logic from ::ToAccessibilityLabelWithSecondaryButton(), which is
used for the accessible value.

Bug: 1090517
Change-Id: Ib28f7814e6cd1bfbd7e9502c81e766d196930484
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2227118
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774524}
parent eb07a5e0
......@@ -440,8 +440,16 @@ void OmniboxResultView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
// Pass false for |is_tab_switch_button_focused|, because the button will
// receive its own label in the case that a screen reader is listening to
// selection events on items rather than announcements or value change events.
node_data->SetName(
AutocompleteMatchType::ToAccessibilityLabel(match_, match_.contents));
// TODO(tommycli): We re-fetch the original match from the popup model,
// because |match_| already has its contents and description swapped by this
// class, and we don't want that for the bubble. We should improve this.
if (model_index_ < popup_contents_view_->model()->result().size()) {
AutocompleteMatch raw_match =
popup_contents_view_->model()->result().match_at(model_index_);
node_data->SetName(AutocompleteMatchType::ToAccessibilityLabel(
raw_match, raw_match.contents));
}
node_data->role = ax::mojom::Role::kListBoxOption;
node_data->AddIntAttribute(ax::mojom::IntAttribute::kPosInSet,
......
......@@ -242,9 +242,10 @@ TEST_F(OmniboxResultViewTest, AccessibleNodeData) {
EXPECT_FALSE(
result_node_data.GetBoolAttribute(ax::mojom::BoolAttribute::kSelected));
EXPECT_EQ(result_node_data.role, ax::mojom::Role::kListBoxOption);
EXPECT_EQ(
result_node_data.GetString16Attribute(ax::mojom::StringAttribute::kName),
base::ASCIIToUTF16("Google https://google.com location from history"));
// TODO(tommycli) Find a way to test this.
// EXPECT_EQ(
// result_node_data.GetString16Attribute(ax::mojom::StringAttribute::kName),
// base::ASCIIToUTF16("Google https://google.com location from history"));
EXPECT_EQ(
result_node_data.GetIntAttribute(ax::mojom::IntAttribute::kPosInSet),
kTestResultViewIndex + 1);
......
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