0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-06 04:08:22 +01:00

Modal: Ignore spurious focus event that Firefox fires at document when switching back to its tab

Fixes #18365
Refs https://bugzilla.mozilla.org/show_bug.cgi?id=1228802
This commit is contained in:
Chris Rebert 2015-12-22 23:02:57 -07:00
parent 2c69e0f810
commit d12ed5520e

View File

@ -259,8 +259,9 @@ const Modal = (($) => {
$(document) $(document)
.off(Event.FOCUSIN) // guard against infinite focus loop .off(Event.FOCUSIN) // guard against infinite focus loop
.on(Event.FOCUSIN, (event) => { .on(Event.FOCUSIN, (event) => {
if (this._element !== event.target && if (document !== event.target &&
(!$(this._element).has(event.target).length)) { this._element !== event.target &&
(!$(this._element).has(event.target).length)) {
this._element.focus() this._element.focus()
} }
}) })