From 122088b1edee33a9ba64e27baa8904d623e26243 Mon Sep 17 00:00:00 2001 From: Kai Wagner Date: Mon, 9 Feb 2026 08:14:22 +0100 Subject: [PATCH] This fixes the sidebar on mobile view, as it stops hiding the sidebar on every size change, as the displaying of the keyboard, changes the viewable size, but should not collapse the sidebar again, as otherwise a search is impossible Signed-off-by: Kai Wagner --- app/javascript/controllers/sidebar_controller.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/javascript/controllers/sidebar_controller.js b/app/javascript/controllers/sidebar_controller.js index 7327d23..a2305aa 100644 --- a/app/javascript/controllers/sidebar_controller.js +++ b/app/javascript/controllers/sidebar_controller.js @@ -15,6 +15,7 @@ export default class extends Controller { this.handleDocumentClick = this.handleDocumentClick.bind(this) window.addEventListener("resize", this.handleWindowResize) document.addEventListener("click", this.handleDocumentClick) + this.wasMobile = this.isMobile() if (!this.hasLayoutTarget || !this.hasSidebarTarget) { return @@ -86,8 +87,12 @@ export default class extends Controller { } handleWindowResize() { - if (this.isMobile()) { + const isMobile = this.isMobile() + if (this.wasMobile && !isMobile) { this.closeMobile() + } + this.wasMobile = isMobile + if (isMobile) { return }