]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fix: error when switching ResponsiveAccordionTabs from tabs to accordion 12148/head
authorGregor <apriljunge@gmail.com>
Fri, 4 Sep 2020 20:05:20 +0000 (22:05 +0200)
committerGregor <apriljunge@gmail.com>
Fri, 4 Sep 2020 20:05:20 +0000 (22:05 +0200)
When switching from tabs to accordion, the tabs instance gets destroyed.
Because destroying tabs and recalculating tabs height in  _setHeight method
rely on the foundatuion mediaquery event, both are executed.
Even if tabs instance got destroyed before.

This behaviour leads to an error in the _setHeight of tabs, because tabs markup is
already destroyed and $tabContent is null.

To prevent this, $tabcontent gets tested to be not falsy.

Closes #12106

js/foundation.tabs.js

index ffc6a0c4abb8e100c9cb16aa1fe9e13f4dab2618..333335d3a362052e43cd0da2aa690e0c4e620209 100644 (file)
@@ -385,6 +385,10 @@ class Tabs extends Plugin {
     var max = 0,
         _this = this; // Lock down the `this` value for the root tabs object
 
+    if (!this.$tabContent) {
+      return;
+    }
+
     this.$tabContent
       .find(`.${this.options.panelClass}`)
       .css('height', '')