diff options
Diffstat (limited to 'app/assets/javascripts/super_sidebar/super_sidebar_collapsed_state_manager.js')
-rw-r--r-- | app/assets/javascripts/super_sidebar/super_sidebar_collapsed_state_manager.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/app/assets/javascripts/super_sidebar/super_sidebar_collapsed_state_manager.js b/app/assets/javascripts/super_sidebar/super_sidebar_collapsed_state_manager.js index 996f88c28ca..1a359533435 100644 --- a/app/assets/javascripts/super_sidebar/super_sidebar_collapsed_state_manager.js +++ b/app/assets/javascripts/super_sidebar/super_sidebar_collapsed_state_manager.js @@ -21,12 +21,10 @@ export const isDesktopBreakpoint = () => bp.windowWidth() >= breakpoints.xl; export const getCollapsedCookie = () => getCookie(SIDEBAR_COLLAPSED_COOKIE) === 'true'; export const toggleSuperSidebarCollapsed = (collapsed, saveCookie) => { - clearTimeout(sidebarState.openPeekTimer); - clearTimeout(sidebarState.closePeekTimer); - findPage().classList.toggle(SIDEBAR_COLLAPSED_CLASS, collapsed); sidebarState.isPeek = false; + sidebarState.isPeekable = Boolean(gon.features?.superSidebarPeek) && collapsed; sidebarState.isCollapsed = collapsed; if (saveCookie && isDesktopBreakpoint()) { @@ -44,7 +42,7 @@ export const initSuperSidebarCollapsedState = (forceDesktopExpandedSidebar = fal toggleSuperSidebarCollapsed(collapsed, false); }; -export const bindSuperSidebarCollapsedEvents = () => { +export const bindSuperSidebarCollapsedEvents = (forceDesktopExpandedSidebar = false) => { let previousWindowWidth = window.innerWidth; const callback = debounce(() => { @@ -52,7 +50,7 @@ export const bindSuperSidebarCollapsedEvents = () => { const widthChanged = previousWindowWidth !== newWindowWidth; if (widthChanged) { - initSuperSidebarCollapsedState(); + initSuperSidebarCollapsedState(forceDesktopExpandedSidebar); } previousWindowWidth = newWindowWidth; }, 100); |