aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2015-12-22 23:21:51 -0700
committerChris Rebert <[email protected]>2015-12-22 23:21:51 -0700
commitaeb25ba52161ef6e50c0cd67df985f2712bcae55 (patch)
tree0514a4272599c0dce93cc87bc6c4e91d6a8a12d4
parent50ce63b5e53ac4733d92a13b4a808e471722b57f (diff)
downloadbootstrap-aeb25ba52161ef6e50c0cd67df985f2712bcae55.tar.xz
bootstrap-aeb25ba52161ef6e50c0cd67df985f2712bcae55.zip
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
-rw-r--r--js/modal.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/js/modal.js b/js/modal.js
index 5049cccf3..cba48507a 100644
--- a/js/modal.js
+++ b/js/modal.js
@@ -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))