]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fix: fix initial state for Accordion without any panel active
authorNicolas Coden <nicolas@ncoden.fr>
Wed, 29 Aug 2018 21:57:57 +0000 (23:57 +0200)
committerNicolas Coden <nicolas@ncoden.fr>
Wed, 29 Aug 2018 21:57:57 +0000 (23:57 +0200)
When going back in history, the Accordion without any panel active is still considered as in its "initial state".

js/foundation.accordion.js

index f5c22f7de722291a76a380deaac5c420b35bd702..f558505c81b2fd436b4ea9a5b7fefb6c090d350e 100644 (file)
@@ -61,6 +61,10 @@ class Accordion extends Plugin {
     });
 
     var $initActive = this.$element.find('.is-active').children('[data-tab-content]');
+    // Remember if we already set up the initial state of the Accordion as it
+    // gives additional privileges in the Accordion methods (like opening
+    // multiple panels even with the "multiExpand" option is disabled)
+    // TODO: refactor and clean this
     this.firstTimeInit = true;
     if ($initActive.length) {
       // Save up the initial hash to return to it later when going back in history
@@ -113,6 +117,7 @@ class Accordion extends Plugin {
     }
 
     this._events();
+    this.firstTimeInit = false;
   }
 
   /**