From ae34741f477360c2941b3069afcb4b3b9cf3221b Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 4 Jan 2025 01:21:53 +0200 Subject: [PATCH] fix(mobile): fluent close of the sidebar --- src/public/app/widgets/mobile_widgets/sidebar_container.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/public/app/widgets/mobile_widgets/sidebar_container.js b/src/public/app/widgets/mobile_widgets/sidebar_container.js index 165537011..4b7708bd1 100644 --- a/src/public/app/widgets/mobile_widgets/sidebar_container.js +++ b/src/public/app/widgets/mobile_widgets/sidebar_container.js @@ -84,7 +84,9 @@ export default class SidebarContainer extends FlexContainer { return; } - const isOpen = this.translatePercentage > -(100 - DRAG_THRESHOLD); + // If the sidebar is closed, snap the sidebar open only if the user swiped over a threshold. + // When the sidebar is open, always close for a smooth experience. + const isOpen = (this.currentTranslate === -100 && this.translatePercentage > -(100 - DRAG_THRESHOLD)); this.sidebarEl.classList.toggle("show", isOpen); this.sidebarEl.style.transform = isOpen ? 'translateX(0)' : 'translateX(-100%)'; this.sidebarEl.style.transition = this.originalSidebarTransition;