Bug 1482025: Don't set aria-label on hbox page action nodes. r=Gijs

This change means that the #pocket-button-box hbox is pruned from the accessibility tree as it should be.

Normally, hbox elements aren't exposed to accessibility, as they are semantically meaningless.
However, this code was previously setting aria-label on hbox elements, which forces the hbox to be exposed to accessibility.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Teh 2018-08-24 03:21:30 +00:00
parent 2a8cad4bfc
commit 598f267168

View File

@ -575,7 +575,14 @@ var BrowserPageActions = {
panelNode.setAttribute("label", title);
}
if (urlbarNode) {
urlbarNode.setAttribute("aria-label", title);
// Some actions (e.g. Save Page to Pocket) have a wrapper node with the
// actual controls inside that wrapper. The wrapper is semantically
// meaningless, so it doesn't get reflected in the accessibility tree.
// In these cases, we don't want to set aria-label because that will
// force the element to be exposed to accessibility.
if (urlbarNode.nodeName != "hbox") {
urlbarNode.setAttribute("aria-label", title);
}
// tooltiptext falls back to the title, so update it too if necessary.
let tooltip = action.getTooltip(window);
if (!tooltip && title) {