fix(portal): close sidebar drawer on resize past desktop breakpoint
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user