Bug 1615301 - Announce search tips as alerts for a11y. r=mak,Jamie,fluent-reviewers,flod

Differential Revision: https://phabricator.services.mozilla.com/D62759

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Drew Willcoxon 2020-02-26 08:44:07 +00:00
parent 175d854d2c
commit f0e5f5d0cb
4 changed files with 13 additions and 4 deletions

View File

@ -201,7 +201,7 @@ class ProviderSearchTips extends UrlbarProvider {
case TIPS.REDIRECT:
result.heuristic = false;
result.payload.textData = {
id: "urlbar-search-tips-redirect",
id: "urlbar-search-tips-redirect-2",
args: {
engineName: defaultEngine.name,
},

View File

@ -1101,6 +1101,15 @@ class UrlbarView {
let helpIcon = item._elements.get("helpButton");
helpIcon.id = item.id + "-tip-help";
helpIcon.style.display = result.payload.helpUrl ? "" : "none";
if (result.providerName == "UrlbarProviderSearchTips") {
// For a11y, we treat search tips as alerts. We use A11yUtils.announce
// instead of role="alert" because role="alert" will only fire an alert
// event when the alert (or something inside it) is the root of an
// insertion. In this case, the entire tip result gets inserted into the
// a11y tree as a single insertion, so no alert event would be fired.
this.window.A11yUtils.announce(result.payload.textData);
}
}
_updateIndices() {

View File

@ -804,8 +804,8 @@ async function checkTip(win, expectedTip, closeView = true) {
case UrlbarProviderSearchTips.TIP_TYPE.REDIRECT:
heuristic = false;
title =
`Start your search here to see suggestions from ${name} ` +
`and your browsing history.`;
`Start your search in the address bar to see suggestions from ` +
`${name} and your browsing history.`;
break;
}
Assert.equal(result.heuristic, heuristic);

View File

@ -106,7 +106,7 @@ urlbar-tip-icon-description =
## Variables:
## $engineName (String): The name of the user's default search engine. e.g. "Google" or "DuckDuckGo".
urlbar-search-tips-onboard = Type less, find more: Search { $engineName } right from your address bar.
urlbar-search-tips-redirect = Start your search here to see suggestions from { $engineName } and your browsing history.
urlbar-search-tips-redirect-2 = Start your search in the address bar to see suggestions from { $engineName } and your browsing history.
##