Skip to content

Commit

Permalink
Modal: Ignore spurious focus event that Firefox fires at document
Browse files Browse the repository at this point in the history
… when switching back to its tab

Fixes twbs#18365
Ports twbs#18638 to v3
Refs https://bugzilla.mozilla.org/show_bug.cgi?id=1228802
  • Loading branch information
cvrebert authored and chiragatlas committed Apr 8, 2019
1 parent e8ef613 commit 4314822
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@
$(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.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))
Expand Down

0 comments on commit 4314822

Please sign in to comment.