]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Swap the autoFocus param so default is no auto focus when using keyboard navi 10509/head
authorSassNinja <kai.falkowski@gmail.com>
Sat, 5 Aug 2017 14:55:51 +0000 (16:55 +0200)
committerSassNinja <kai.falkowski@gmail.com>
Sat, 5 Aug 2017 14:55:51 +0000 (16:55 +0200)
The param must be explicitely set to true to trigger this feature.

js/foundation.drilldown.js

index e8b7a6186b1e211f89c7654f85c52aba42f0d0fa..31216939f2216437a2b2d7c09f842568649ab7ca 100644 (file)
@@ -378,7 +378,7 @@ class Drilldown extends Plugin {
    * @function
    * @fires Drilldown#open
    * @param {jQuery} $elem - the target (sub)menu (`ul` tag)
-   * @param {boolean} autoFocus - if false the first link in the target (sub)menu won't get auto focused
+   * @param {boolean} autoFocus - if true the first link in the target (sub)menu gets auto focused
    */
   _showMenu($elem, autoFocus) {
 
@@ -392,7 +392,7 @@ class Drilldown extends Plugin {
 
     // If target menu is root, focus first link & exit
     if ($elem.is('[data-drilldown]')) {
-      if (autoFocus !== false) $elem.find('li[role="treeitem"] > a').first().focus();
+      if (autoFocus === true) $elem.find('li[role="treeitem"] > a').first().focus();
       if (this.options.autoHeight) this.$wrapper.css('height', $elem.data('calcHeight'));
       return;
     }
@@ -414,7 +414,7 @@ class Drilldown extends Plugin {
       // Last child makes sure the event gets always triggered even if going through several menus
       if (isLastChild === true) {
         $(this).one(transitionend($(this)), () => {
-          if (autoFocus !== false) {
+          if (autoFocus === true) {
             $elem.find('li[role="treeitem"] > a').first().focus();
           }
         });