]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Fixes issue when putting focus to an input outside of the modal. 8453/head
authorMarius Olbertz <marius.olbertz@gmail.com>
Thu, 24 Mar 2016 08:03:19 +0000 (09:03 +0100)
committerMarius Olbertz <marius.olbertz@gmail.com>
Thu, 24 Mar 2016 08:03:19 +0000 (09:03 +0100)
js/foundation.reveal.js

index 046801cc867747584c8c3f2ae1dc9a0e823ca323..5fb2f617e42713cc04657e526de58666095e3243 100644 (file)
@@ -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]'))) {