From 50ce63b5e53ac4733d92a13b4a808e471722b57f Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Tue, 22 Dec 2015 23:18:06 -0700 Subject: [PATCH 1/2] Add visual test for #18365 See also https://bugzilla.mozilla.org/show_bug.cgi?id=1228802 --- js/tests/visual/modal.html | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/js/tests/visual/modal.html b/js/tests/visual/modal.html index 4342f0ce44..865511f97c 100644 --- a/js/tests/visual/modal.html +++ b/js/tests/visual/modal.html @@ -127,12 +127,37 @@ + +

+ + (See Issue #18365) +

@@ -149,12 +174,30 @@ From aeb25ba52161ef6e50c0cd67df985f2712bcae55 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Tue, 22 Dec 2015 23:21:51 -0700 Subject: [PATCH 2/2] 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))