Commit 07f6c1b8 authored by Tim Zallmann's avatar Tim Zallmann

Moves the Initialisation of the frequent Item Dropdowns to Idle Callback

parent 267ce96e
...@@ -47,6 +47,11 @@ export default { ...@@ -47,6 +47,11 @@ export default {
} }
eventHub.$on(`${this.namespace}-dropdownOpen`, this.dropdownOpenHandler); eventHub.$on(`${this.namespace}-dropdownOpen`, this.dropdownOpenHandler);
// As we init it through requestIdleCallback it could be that the dropdown is already open
if (document.getElementById(`nav-${this.namespace}-dropdown`).classList.contains('show')) {
this.dropdownOpenHandler();
}
}, },
beforeDestroy() { beforeDestroy() {
eventHub.$off(`${this.namespace}-dropdownOpen`, this.dropdownOpenHandler); eventHub.$off(`${this.namespace}-dropdownOpen`, this.dropdownOpenHandler);
......
...@@ -17,7 +17,7 @@ const frequentItemDropdowns = [ ...@@ -17,7 +17,7 @@ const frequentItemDropdowns = [
}, },
]; ];
document.addEventListener('DOMContentLoaded', () => { function initFrequentItemDropdowns() {
frequentItemDropdowns.forEach(dropdown => { frequentItemDropdowns.forEach(dropdown => {
const { namespace, key } = dropdown; const { namespace, key } = dropdown;
const el = document.getElementById(`js-${namespace}-dropdown`); const el = document.getElementById(`js-${namespace}-dropdown`);
...@@ -66,4 +66,8 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -66,4 +66,8 @@ document.addEventListener('DOMContentLoaded', () => {
}, },
}); });
}); });
}
document.addEventListener('DOMContentLoaded', () => {
requestIdleCallback(initFrequentItemDropdowns);
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment