Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Fix: Trigger drilldown resize when opening tray overlay #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion test/dummy/app/frontend/javascripts/components/tray-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@
// Add the transition and opening classes
Tray.$classTarget.classList.add(Tray.classes.transitioning);
Tray.$classTarget.classList.add(Tray.classes.open);


// Resize Drilldowns
Tray.resizeDrilldowns();

// Wait until transition is completed and remove the transitioning class
Tray.transitionTimer = setTimeout(function(){
Tray.$classTarget.classList.remove(Tray.classes.transitioning);
Expand Down Expand Up @@ -212,12 +215,23 @@
});
},

resizeDrilldowns: function(){
if (Ornament.C.Drilldown && Tray.$drilldowns) {
Tray.$drilldowns.forEach(function ($drilldown) {
Ornament.triggerEvent($drilldown, Ornament.C.Drilldown.triggerNamespace + ":resize");
});
}
},

init: function(){
Tray.$buttons = document.querySelectorAll("[" + Tray.selectors.buttons + "]");
Tray.$closeButtons = document.querySelectorAll("[" + Tray.selectors.closeButtons + "]");
Tray.$scrollPusher = document.querySelector("[" + Tray.selectors.scrollPusher + "]");
Tray.$classTarget = document.body;
Tray.$overlay = document.querySelector("[" + Tray.selectors.overlay + "]");
if(Tray.$overlay) {
Tray.$drilldowns = Tray.$overlay.querySelectorAll("[data-drilldown-init]");
}

// Bind Toggle Buttons
Tray.forEachButton(function($button) {
Expand Down