fix(#6105): also close floating picker on breakpoint-crossing resize that reveals a drawer

Codex found a sibling of the swipe-stacking edge: a direct landscape/tablet->phone
resize can re-reveal an already-open mobile sidebar or workspace panel under the
body-reparented picker (z-200 siblings, no click to trigger outside-close). The
window resize handler now guardedly closes+restores the picker before re-syncing
drawer state, gated on entering phone width AND a drawer/panel actually being open,
so ordinary keyboard/URL-bar reflows don't dismiss the picker mid-use.
This commit is contained in:
nesquena-hermes committed 2026-07-16 00:59:01 +00:00
1 parent 7091c4aa84
commit 7ed58510bc
1 file changed
+17
+17
View File
@@ -2482,6 +2482,23 @@ function applyEmptyStateSuggestionPref(){
}
window.addEventListener('resize',()=>{
// #6105/#6080: the floating phone model picker is a <body> child at z-index:200,
// the same level as the mobile sidebar drawer and the workspace panel. A direct
// landscape/tablet→phone resize can re-reveal an already-open drawer/panel
// *underneath* the picker (no click fires, so outside-click-close doesn't run).
// Close + restore the picker before we re-sync drawer state, but only when a
// phone-width layout will actually surface one of those z-200 siblings — so an
// ordinary keyboard/URL-bar reflow doesn't dismiss the picker mid-use.
try{
if(typeof closeModelDropdown==='function' && !_isDesktopWidth()){
const dd=document.getElementById('composerModelDropdown');
if(dd&&dd.classList.contains('open')){
const drawerOpen=!!document.querySelector('.sidebar.mobile-open');
const panelOpen=(typeof _workspacePanelMode!=='undefined'&&_workspacePanelMode&&_workspacePanelMode!=='closed');
if(drawerOpen||panelOpen) closeModelDropdown();
}
}
}catch(_){}
_syncWorkspacePanelInlineWidth();
syncWorkspacePanelState();
if(!window.visualViewport) _forceMobileViewportReflow();