From 0866ce2301945fe0ea2d427daa08ba5cb4d8cd19 Mon Sep 17 00:00:00 2001 From: Gregor Date: Fri, 4 Sep 2020 22:05:20 +0200 Subject: [PATCH] fix: error when switching ResponsiveAccordionTabs from tabs to accordion 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/foundation.tabs.js b/js/foundation.tabs.js index ffc6a0c4a..333335d3a 100644 --- a/js/foundation.tabs.js +++ b/js/foundation.tabs.js @@ -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', '') -- 2.47.2