From e9d4b32ff5d0a5ce05911f02699618316ab85d4c Mon Sep 17 00:00:00 2001 From: Marius Olbertz Date: Thu, 24 Mar 2016 09:03:19 +0100 Subject: [PATCH] Fixes issue when putting focus to an input outside of the modal. --- js/foundation.reveal.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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]'))) { -- 2.47.2