Bug 1583535 - The Megabar should not expand when auto-focused after a panel is closed. r=dao

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Harry Twyford 2019-10-10 13:51:26 +00:00
Родитель a566f56c8b
Коммит 0733410a0c
2 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -1801,6 +1801,8 @@ class UrlbarInput {
// We handle mouse-based expansion events separately in _on_click.
if (this._focusedViaMousedown) {
this._focusedViaMousedown = false;
} else if (this.inputField.hasAttribute("refocused-by-panel")) {
this._maybeSelectAll(true);
} else {
this.startLayoutExtend();
}

Просмотреть файл

@ -255,13 +255,17 @@
function doFocus() {
// Focus was set on an element inside this panel,
// so we need to move it back to where it was previously
// so we need to move it back to where it was previously.
// Elements can use refocused-by-panel to change their focus behaviour
// when re-focused by a panel hiding.
prevFocus.setAttribute("refocused-by-panel", true);
try {
let fm = Services.focus;
fm.setFocus(prevFocus, fm.FLAG_NOSCROLL);
} catch (e) {
prevFocus.focus();
}
prevFocus.removeAttribute("refocused-by-panel");
}
var currentFocus = this._currentFocus;
var prevFocus = this._prevFocus ? this._prevFocus.get() : null;