From df74d702af2aa2d3351878aa74b83ae532df3a5e Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sun, 17 May 2026 13:32:40 -0400 Subject: [PATCH] fix(portal): close sidebar drawer on resize past desktop breakpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backdrop display:block isn't media-scoped in fp_portal_sidebar.scss (intentional — JS owns the drawer lifecycle). Without a resize listener, opening the drawer at <=768px and resizing the browser to >768px leaves the semi-opaque backdrop visible on desktop while the sidebar visually snaps back to its sticky rail. Resize handler calls toggleOpen(false) when crossing the breakpoint with .o_fp_open still set. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../static/src/js/fp_portal_sidebar.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fusion_plating/fusion_plating_portal/static/src/js/fp_portal_sidebar.js b/fusion_plating/fusion_plating_portal/static/src/js/fp_portal_sidebar.js index a86ffe78..d7e829e8 100644 --- a/fusion_plating/fusion_plating_portal/static/src/js/fp_portal_sidebar.js +++ b/fusion_plating/fusion_plating_portal/static/src/js/fp_portal_sidebar.js @@ -38,6 +38,17 @@ } }); }); + + // Resize safety: closing the drawer when the user crosses the desktop + // breakpoint prevents the backdrop's display:block from leaking onto + // the desktop layout. SCSS scopes the sidebar's drawer transform to + // @media (max-width: 768px), but the backdrop's display rule isn't + // media-scoped (intentionally — the JS owns that lifecycle). + window.addEventListener("resize", function () { + if (window.innerWidth > 768 && sidebar.classList.contains("o_fp_open")) { + toggleOpen(false); + } + }); } if (document.readyState === "loading") {