0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-28 20:52:21 +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)
.off(Event.FOCUSIN) // guard against infinite focus loop
.on(Event.FOCUSIN, (event) => {
if (this._element !== event.target &&
(!$(this._element).has(event.target).length)) {
if (document !== event.target &&
this._element !== event.target &&
(!$(this._element).has(event.target).length)) {
this._element.focus()
}
})