diff --git a/modules/UI/side_pannels/SideContainerToggler.js b/modules/UI/side_pannels/SideContainerToggler.js index 763d07d41..b845a59e5 100644 --- a/modules/UI/side_pannels/SideContainerToggler.js +++ b/modules/UI/side_pannels/SideContainerToggler.js @@ -16,17 +16,27 @@ const SideContainerToggler = { init(eventEmitter) { this.eventEmitter = eventEmitter; - // Adds a listener for the animation end event that would take care - // of hiding all internal containers when the extendedToolbarPanel is + // We may not have a side toolbar container, for example, in + // filmstrip-only mode. + const sideToolbarContainer + = document.getElementById("sideToolbarContainer"); + + if (!sideToolbarContainer) + return; + + // Adds a listener for the animationend event that would take care of + // hiding all internal containers when the extendedToolbarPanel is // closed. - document.getElementById("sideToolbarContainer") - .addEventListener("animationend", function(e) { - if(e.animationName === "slideOutExt") + sideToolbarContainer.addEventListener( + "animationend", + function(e) { + if (e.animationName === "slideOutExt") $("#sideToolbarContainer").children().each(function() { if ($(this).hasClass("show")) SideContainerToggler.hideInnerContainer($(this)); }); - }, false); + }, + false); }, /** @@ -134,4 +144,4 @@ const SideContainerToggler = { } }; -export default SideContainerToggler; \ No newline at end of file +export default SideContainerToggler;