зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1328410 - only restore focus if the user did not explicitly place focus elsewhere, r=jaws
MozReview-Commit-ID: CdL2gN7EgbF --HG-- extra : rebase_source : 0ccedd666b999e4adbab8443bb75c0695606f304
This commit is contained in:
Родитель
45d97aa6f1
Коммит
c2823e53e4
|
@ -331,6 +331,19 @@
|
|||
var prevFocus = this._prevFocus ? this._prevFocus.get() : null;
|
||||
this._currentFocus = null;
|
||||
this._prevFocus = null;
|
||||
|
||||
// Avoid changing focus if focus changed while we hide the popup
|
||||
// (This can happen e.g. if the popup is hiding as a result of a
|
||||
// click/keypress that focused something)
|
||||
let nowFocus;
|
||||
try {
|
||||
nowFocus = document.commandDispatcher.focusedElement;
|
||||
} catch (e) {
|
||||
nowFocus = document.activeElement;
|
||||
}
|
||||
if (nowFocus && nowFocus != currentFocus)
|
||||
return;
|
||||
|
||||
if (prevFocus && this.getAttribute("norestorefocus") != "true") {
|
||||
// Try to restore focus
|
||||
try {
|
||||
|
|
Загрузка…
Ссылка в новой задаче