зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1577801 - Stop messing with aria-activedescendant when mousing over one-off search buttons. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D44162 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6839d6cbad
Коммит
4421e12bbe
|
@ -114,11 +114,9 @@ class SearchOneOffs {
|
||||||
this.contextMenuPopup.addEventListener("popupshowing", listener);
|
this.contextMenuPopup.addEventListener("popupshowing", listener);
|
||||||
this.contextMenuPopup.addEventListener("popuphiding", listener);
|
this.contextMenuPopup.addEventListener("popuphiding", listener);
|
||||||
this.contextMenuPopup.addEventListener("popupshown", aEvent => {
|
this.contextMenuPopup.addEventListener("popupshown", aEvent => {
|
||||||
this._ignoreMouseEvents = true;
|
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
});
|
});
|
||||||
this.contextMenuPopup.addEventListener("popuphidden", aEvent => {
|
this.contextMenuPopup.addEventListener("popuphidden", aEvent => {
|
||||||
this._ignoreMouseEvents = false;
|
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -303,7 +301,15 @@ class SearchOneOffs {
|
||||||
val.setAttribute("selected", "true");
|
val.setAttribute("selected", "true");
|
||||||
}
|
}
|
||||||
this._selectedButton = val;
|
this._selectedButton = val;
|
||||||
this._updateStateForButton(null);
|
|
||||||
|
if (this.textbox) {
|
||||||
|
if (val) {
|
||||||
|
this.textbox.setAttribute("aria-activedescendant", val.id);
|
||||||
|
} else {
|
||||||
|
this.textbox.removeAttribute("aria-activedescendant");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (val && !val.engine) {
|
if (val && !val.engine) {
|
||||||
// If the button doesn't have an engine, then clear the popup's
|
// If the button doesn't have an engine, then clear the popup's
|
||||||
// selection to indicate that pressing Return while the button is
|
// selection to indicate that pressing Return while the button is
|
||||||
|
@ -649,29 +655,6 @@ class SearchOneOffs {
|
||||||
return document.getElementById(id);
|
return document.getElementById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the popup and textbox for the currently selected or moused-over
|
|
||||||
* button.
|
|
||||||
*
|
|
||||||
* @param {DOMElement} mousedOverButton
|
|
||||||
* The currently moused-over button, or null if there isn't one.
|
|
||||||
*/
|
|
||||||
_updateStateForButton(mousedOverButton) {
|
|
||||||
let button = mousedOverButton;
|
|
||||||
|
|
||||||
// If there's no moused-over button, then the one-offs should reflect
|
|
||||||
// the selected button, if any.
|
|
||||||
button = button || this.selectedButton;
|
|
||||||
|
|
||||||
if (this.textbox) {
|
|
||||||
if (!button) {
|
|
||||||
this.textbox.removeAttribute("aria-activedescendant");
|
|
||||||
} else {
|
|
||||||
this.textbox.setAttribute("aria-activedescendant", button.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getSelectableButtons(aIncludeNonEngineButtons) {
|
getSelectableButtons(aIncludeNonEngineButtons) {
|
||||||
let buttons = [];
|
let buttons = [];
|
||||||
for (
|
for (
|
||||||
|
@ -1080,29 +1063,8 @@ class SearchOneOffs {
|
||||||
target.classList.contains("addengine-item")) ||
|
target.classList.contains("addengine-item")) ||
|
||||||
target.classList.contains("addengine-menu-button")
|
target.classList.contains("addengine-menu-button")
|
||||||
) {
|
) {
|
||||||
let menuButton = this.querySelector(".addengine-menu-button");
|
|
||||||
this._updateStateForButton(menuButton);
|
|
||||||
this._addEngineMenuShouldBeOpen = true;
|
this._addEngineMenuShouldBeOpen = true;
|
||||||
this._resetAddEngineMenuTimeout();
|
this._resetAddEngineMenuTimeout();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target.localName != "button") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ignore mouse events when the context menu is open.
|
|
||||||
if (this._ignoreMouseEvents) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let isOneOff = target.classList.contains("searchbar-engine-one-off-item");
|
|
||||||
if (
|
|
||||||
isOneOff ||
|
|
||||||
target.classList.contains("addengine-item") ||
|
|
||||||
target.classList.contains("search-setting-button")
|
|
||||||
) {
|
|
||||||
this._updateStateForButton(target);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1115,22 +1077,9 @@ class SearchOneOffs {
|
||||||
target.classList.contains("addengine-item")) ||
|
target.classList.contains("addengine-item")) ||
|
||||||
target.classList.contains("addengine-menu-button")
|
target.classList.contains("addengine-menu-button")
|
||||||
) {
|
) {
|
||||||
this._updateStateForButton(null);
|
|
||||||
this._addEngineMenuShouldBeOpen = false;
|
this._addEngineMenuShouldBeOpen = false;
|
||||||
this._resetAddEngineMenuTimeout();
|
this._resetAddEngineMenuTimeout();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.localName != "button") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't update the mouseover state if the context menu is open.
|
|
||||||
if (this._ignoreMouseEvents) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._updateStateForButton(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_on_click(event) {
|
_on_click(event) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче