From 90c4e45f8be0ee2403cefc9073025a6a7bda99e3 Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Wed, 1 Aug 2018 00:26:31 +0200 Subject: [PATCH] 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()` --- js/foundation.drilldown.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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() { -- 2.47.2