]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Merge pull request #9635 from Owlbertz/drilldown-esc-bug
authorKevin Ball <kmball11@gmail.com>
Thu, 12 Jan 2017 17:37:25 +0000 (09:37 -0800)
committerGitHub <noreply@github.com>
Thu, 12 Jan 2017 17:37:25 +0000 (09:37 -0800)
Fixed ESC button on drilldown menus.

1  2 
js/foundation.drilldown.js

index 53673bccadf2edf63bb2d014b06c5cac4f0894e6,16c19ceace5d193a464d420ffc6033c0f3050044..8a56cf4ede9c10105048e7404612d7b18f53e8a9
@@@ -232,12 -231,14 +232,15 @@@ class Drilldown 
          },
          down: function() {
            $nextElement.focus();
 -          return true;
 +          // Don't tap focus on last element in root ul
 +          return !$element.is(_this.$element.find('> li:last-child > a'));
          },
          close: function() {
-           _this._back();
-           //_this.$menuItems.first().focus(); // focus to first element
+           // Don't close on element in root ul
+           if (!$element.is(_this.$element.find('> li > a'))) {
+             _this._hide($element.parent().parent());
+             $element.parent().parent().siblings('a').focus();
+           }
          },
          open: function() {
            if (!$element.is(_this.$menuItems)) { // not menu item means back button