From: Nicolas Coden Date: Tue, 31 Jul 2018 22:26:31 +0000 (+0200) Subject: fix: set a default for the current menu in Drilldown before it is used X-Git-Tag: v6.6.0~3^2~124^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90c4e45f8be0ee2403cefc9073025a6a7bda99e3;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: set a default for the current menu in Drilldown before it is used `$currentMenu` is used by `_getMaxDims`. Changes: move `$currentMenu` initialization to `_init()` --- diff --git a/js/foundation.drilldown.js b/js/foundation.drilldown.js index 7add792a1..9deaf3272 100644 --- a/js/foundation.drilldown.js +++ b/js/foundation.drilldown.js @@ -61,6 +61,11 @@ class Drilldown extends Plugin { this.$submenuAnchors = this.$element.find('li.is-drilldown-submenu-parent').children('a'); this.$submenus = this.$submenuAnchors.parent('li').children('[data-submenu]').attr('role', 'group'); this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'treeitem').find('a'); + + // Set the main menu as current by default (unless a submenu is selected) + // Used to set the wrapper height when the drilldown is closed/reopened from any (sub)menu + this.$currentMenu = this.$element; + this.$element.attr('data-mutate', (this.$element.attr('data-drilldown') || GetYoDigits(6, 'drilldown'))); this._prepareMenu(); @@ -128,10 +133,6 @@ class Drilldown extends Plugin { // set wrapper this.$wrapper = this.$element.parent(); this.$wrapper.css(this._getMaxDims()); - - // Set the main menu as current by default (unless a submenu is selected) - // Used to set the wrapper height when the drilldown is closed/reopened from any (sub)menu - this.$currentMenu = this.$element; } _resize() {