mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 1062128 - set tooltiptext for new tab button directly for a11y reasons, r=johannh
Differential Revision: https://phabricator.services.mozilla.com/D13406 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
90b02dc14b
commit
45794c41ea
@ -5912,8 +5912,7 @@ if (AppConstants.platform == "macosx") {
|
||||
}
|
||||
|
||||
const gDynamicTooltipCache = new Map();
|
||||
function UpdateDynamicShortcutTooltipText(aTooltip) {
|
||||
let nodeId = aTooltip.triggerNode.id || aTooltip.triggerNode.getAttribute("anonid");
|
||||
function GetDynamicShortcutTooltipText(nodeId) {
|
||||
if (!gDynamicTooltipCache.has(nodeId) && nodeId in nodeToTooltipMap) {
|
||||
let strId = nodeToTooltipMap[nodeId];
|
||||
let args = [];
|
||||
@ -5926,9 +5925,15 @@ function UpdateDynamicShortcutTooltipText(aTooltip) {
|
||||
}
|
||||
gDynamicTooltipCache.set(nodeId, gNavigatorBundle.getFormattedString(strId, args));
|
||||
}
|
||||
aTooltip.setAttribute("label", gDynamicTooltipCache.get(nodeId));
|
||||
return gDynamicTooltipCache.get(nodeId);
|
||||
}
|
||||
|
||||
function UpdateDynamicShortcutTooltipText(aTooltip) {
|
||||
let nodeId = aTooltip.triggerNode.id || aTooltip.triggerNode.getAttribute("anonid");
|
||||
aTooltip.setAttribute("label", GetDynamicShortcutTooltipText(nodeId));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* - [ Dependencies ] ---------------------------------------------------------
|
||||
* utilityOverlay.js:
|
||||
|
@ -93,7 +93,7 @@
|
||||
anonid="tabs-newtab-button"
|
||||
command="cmd_newNavigatorTab"
|
||||
onclick="checkForMiddleClick(this, event);"
|
||||
tooltip="dynamic-shortcut-tooltip"/>
|
||||
/>
|
||||
<xul:spacer class="closing-tabs-spacer" anonid="closing-tabs-spacer"
|
||||
style="width: 0;"/>
|
||||
</xul:arrowscrollbox>
|
||||
@ -112,6 +112,10 @@
|
||||
var tab = this.firstElementChild;
|
||||
tab.label = this.emptyTabTitle;
|
||||
|
||||
let newTabButton = document.getAnonymousElementByAttribute(
|
||||
this, "anonid", "tabs-newtab-button");
|
||||
newTabButton.setAttribute("tooltiptext", GetDynamicShortcutTooltipText("tabs-newtab-button"));
|
||||
|
||||
window.addEventListener("resize", this);
|
||||
|
||||
Services.prefs.addObserver("privacy.userContext", this);
|
||||
|
Loading…
Reference in New Issue
Block a user