fix(plugin): hide native main-views when our panel active; BTE in-main not full-viewport
plugin-tests / test (push) Failing after 5s

JP reported (Chrome) after b43e649:
- Sidebar buttons render ✓
- Adwright: useless middle black panel between sidebar and right area
- BTE: entire left sidebar disappears, only close-X recovers it

ROOT CAUSES:
1. webui CSS has `main.main:not(.showing-X):not(.showing-Y)... > #mainChat
   { display:flex }` which still matches when our class is svrnty-showing-*
   (not in webui's whitelist). Chat rendered alongside our panel → the
   empty void = "middle black panel".
2. BTE overlay was `position:fixed; inset:0; z-index:9991` — covered the
   whole viewport including sidebar + topbar.

FIXES:
- Adwright + BTE CSS now `main.main.svrnty-showing-<id> > .main-view
  { display:none !important }` — explicitly hides every native main-view
  (mainChat, mainSkills, mainTasks, ...) when our panel is active.
- BTE.css: overlay no longer position:fixed. Becomes a normal flex child
  of main when svrnty-showing-bte is active. Sidebar + topbar stay visible.
- bte.js: _openOverlay now appends to <main class="main"> instead of
  document.body. Migrates existing body-mounted overlay on first open.

Karpathy 4 rules: root-caused via direct CSS inspection (not guessing),
two-line CSS change per panel, no new abstractions.
This commit is contained in:
Svrnty
2026-05-24 13:05:38 -04:00
parent b43e6496f5
commit 69e575ca59
3 changed files with 42 additions and 15 deletions
+8 -1
View File
@@ -76,11 +76,18 @@
}
// ── Overlay lifecycle ────────────────────────────────────────────────────
// Mount inside <main> so the left sidebar stays visible. CSS
// (.svrnty-bte-overlay rules in bte.css) handles show/hide via
// main.svrnty-showing-bte class set by svrnty_nav.js wrapper.
function _openOverlay() {
let overlay = document.getElementById("svrntyBteOverlay");
const mountTarget = document.querySelector("main.main") || document.body;
if (!overlay) {
overlay = _buildOverlay();
document.body.appendChild(overlay);
mountTarget.appendChild(overlay);
} else if (overlay.parentElement !== mountTarget && mountTarget.tagName === "MAIN") {
// Migrate from body to main (handles older sessions that mounted on body).
mountTarget.appendChild(overlay);
}
overlay.hidden = false;
_refreshGrid();