From 6c88bf8899580a2268ac6fa1f2aaa9b50cc8297f Mon Sep 17 00:00:00 2001 From: Svrnty Date: Sun, 24 May 2026 17:05:41 -0400 Subject: [PATCH] =?UTF-8?q?fix(adwright):=20route=20=E2=86=97BTE=20crossli?= =?UTF-8?q?nk=20through=20canonical=20switchPanel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Adwright ↗BTE button called SvrntyBTE.open() directly, which sets overlay.hidden=false but never flips main.svrnty-showing-bte. The CSS gates BTE overlay visibility on that class, so the click did nothing visible — overlay was mounted but display:none. Route the click through window.switchPanel("bte") instead so the canonical nav wrapper handles class flipping + event dispatch identically to the sidebar BTE button. Validated via Playwright with 6 gates: V1 sidebar BTE (1 event, class set, visible), V2 ↗BTE crosslink (1 event, class flip, visible), V3 Adwright nav (class flip, BTE hidden), V4 main classes correct, V5 console clean, V6 /api/bte/proxy 200 OK. All pass. Co-Authored-By: Claude Opus 4.7 (1M context) --- static/adwright.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/static/adwright.js b/static/adwright.js index 1eed445..c0fb1c3 100644 --- a/static/adwright.js +++ b/static/adwright.js @@ -154,10 +154,17 @@ _activateTab(id); }); }); - // Cross-panel link to BTE Command Center. + // Cross-panel link to BTE Command Center. Route through canonical + // switchPanel so main.svrnty-showing-bte class gets flipped (CSS gates + // overlay visibility on that class). SvrntyBTE.open is fallback for + // the early-boot edge case where the nav wrapper isn't installed yet. const bteBtn = panel.querySelector("#svrntyAwOpenBte"); if (bteBtn) bteBtn.addEventListener("click", () => { - if (window.SvrntyBTE && window.SvrntyBTE.open) window.SvrntyBTE.open(); + if (typeof window.switchPanel === "function") { + window.switchPanel("bte", { fromRailClick: true }); + } else if (window.SvrntyBTE && window.SvrntyBTE.open) { + window.SvrntyBTE.open(); + } }); // One-click profile switch to cmo-planb. const switchBtn = panel.querySelector("#svrntyAwSwitchCmo");