From aeb25ba52161ef6e50c0cd67df985f2712bcae55 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Tue, 22 Dec 2015 23:21:51 -0700 Subject: [PATCH] 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 --- js/modal.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/modal.js b/js/modal.js index 5049cccf36..cba48507a4 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)) -- 2.47.2