vendor/assets/js/foundation.tabs.js.es6 in foundation-rails-6.2.1.0 vs vendor/assets/js/foundation.tabs.js.es6 in foundation-rails-6.2.3.0

- old
+ new

@@ -91,13 +91,16 @@ * @private */ _events() { this._addKeyHandler(); this._addClickHandler(); - + this._setHeightMqHandler = null; + if (this.options.matchHeight) { - $(window).on('changed.zf.mediaquery', this._setHeight.bind(this)); + this._setHeightMqHandler = this._setHeight.bind(this); + + $(window).on('changed.zf.mediaquery', this._setHeightMqHandler); } } /** * Adds click handlers for items within the tabs. @@ -127,12 +130,11 @@ var $firstTab = _this.$element.find('li:first-of-type'); var $lastTab = _this.$element.find('li:last-of-type'); this.$tabTitles.off('keydown.zf.tabs').on('keydown.zf.tabs', function(e){ if (e.which === 9) return; - e.stopPropagation(); - e.preventDefault(); + var $element = $(this), $elements = $element.parent('ul').children('li'), $prevElement, $nextElement; @@ -161,10 +163,14 @@ _this._handleTabChange($prevElement); }, next: function() { $nextElement.find('[role="tab"]').focus(); _this._handleTabChange($nextElement); + }, + handled: function() { + e.stopPropagation(); + e.preventDefault(); } }); }); } @@ -269,10 +275,12 @@ .off('.zf.tabs').hide().end() .find(`.${this.options.panelClass}`) .hide(); if (this.options.matchHeight) { - $(window).off('changed.zf.mediaquery'); + if (this._setHeightMqHandler != null) { + $(window).off('changed.zf.mediaquery', this._setHeightMqHandler); + } } Foundation.unregisterPlugin(this); } }