From: Marius Olbertz Date: Thu, 24 Mar 2016 08:03:19 +0000 (+0100) Subject: Fixes issue when putting focus to an input outside of the modal. X-Git-Tag: v6.2.1~35^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8453%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Fixes issue when putting focus to an input outside of the modal. --- diff --git a/js/foundation.reveal.js b/js/foundation.reveal.js index 046801cc8..5fb2f617e 100644 --- a/js/foundation.reveal.js +++ b/js/foundation.reveal.js @@ -292,9 +292,6 @@ class Reveal { } } }); - if (_this.focusableElements.length === 0) { // no focusable elements inside the modal at all, prevent tabbing in general - e.preventDefault(); - } }); } @@ -308,12 +305,18 @@ class Reveal { _this.focusableElements.eq(0).focus(); e.preventDefault(); } + if (_this.focusableElements.length === 0) { // no focusable elements inside the modal at all, prevent tabbing in general + e.preventDefault(); + } }, tab_backward: function() { if (_this.$element.find(':focus').is(_this.focusableElements.eq(0)) || _this.$element.is(':focus')) { // left modal upwards, setting focus to last element _this.focusableElements.eq(-1).focus(); e.preventDefault(); } + if (_this.focusableElements.length === 0) { // no focusable elements inside the modal at all, prevent tabbing in general + e.preventDefault(); + } }, open: function() { if (_this.$element.find(':focus').is(_this.$element.find('[data-close]'))) {