Commit c3e939ed authored by tby's avatar tby Committed by Commit Bot

[Launcher settings] Add accessible names for search results.

Settings results aren't distinguishable from other results when used
with a screen reader. This CL manually sets their accessible name, and
includes the name of the settings app at the end to mark them.

Settings results are read as, for example:

  "Powerwash, reset settings, settings"

This is consistent with other results' a11y names, which have a
"result, category" pattern.

Bug: 1068851
Change-Id: I24e12e21c05d43bcc99ab89c34a5b508d0f6fff4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2237563Reviewed-by: default avatarThanh Nguyen <thanhdng@chromium.org>
Commit-Queue: Tony Yeoman <tby@chromium.org>
Cr-Commit-Position: refs/heads/master@{#777256}
parent d3fd3aab
......@@ -134,6 +134,20 @@ OsSettingsResult::OsSettingsResult(
} else if (result->type != SettingsResultType::kSection) {
SetDetails(hierarchy.back());
}
// Manually build the accessible name for the search result, in a way that
// parallels the regular accessible names set by
// SearchResultBaseView::ComputeAccessibleName.
base::string16 accessible_name = title();
if (!details().empty()) {
accessible_name += base::ASCIIToUTF16(", ");
accessible_name += details();
}
accessible_name += base::ASCIIToUTF16(", ");
// The first element in the settings hierarchy is always the top-level
// localized name of the Settings app.
accessible_name += hierarchy[0];
SetAccessibleName(accessible_name);
}
OsSettingsResult::~OsSettingsResult() = default;
......
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