0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-03-15 15:29:22 +01:00

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

Fixes #18365
Ports #18638 to v3
Refs https://bugzilla.mozilla.org/show_bug.cgi?id=1228802
This commit is contained in:
Chris Rebert 2015-12-22 23:21:51 -07:00
parent 50ce63b5e5
commit aeb25ba521

View File

@ -140,7 +140,9 @@
$(document) $(document)
.off('focusin.bs.modal') // guard against infinite focus loop .off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) { .on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { if (document !== event.target &&
this.$element[0] !== e.target &&
!this.$element.has(e.target).length) {
this.$element.trigger('focus') this.$element.trigger('focus')
} }
}, this)) }, this))