diff --git a/sidebar-preload.js b/sidebar-preload.js index 68c2ce6d..d4269090 100644 --- a/sidebar-preload.js +++ b/sidebar-preload.js @@ -44,14 +44,30 @@ contextBridge.exposeInMainWorld("silentmode", { window.addEventListener("DOMContentLoaded", () => { const grip = document.createElement("div"); grip.setAttribute("aria-label", "Resize sidebar"); + // A visible-at-rest separator. Fully transparent used to hide the seam + // between the tab area and the sidebar completely — users couldn't tell + // where one ended and the other began. A mid-gray at moderate alpha + // reads on every panel background (dark and light) without competing + // for attention. Hover / drag ramps to acid so the grab affordance + // still stands out. + const IDLE_BG = "rgba(140,150,170,.55)"; + const HOVER_BG = "rgba(214,255,61,.35)"; + const ACTIVE_BG = "rgba(214,255,61,.55)"; grip.style.cssText = [ "position:fixed", "left:0", "top:0", "bottom:0", - "width:5px", "cursor:col-resize", "z-index:2147483647", - "background:transparent", + "width:2px", "cursor:col-resize", "z-index:2147483647", + "background:" + IDLE_BG, + // A wider invisible hit target sits over the visible strip so + // dragging still catches a 5-px slack — visible line stays a + // clean 2 px. + "box-shadow:2px 0 0 0 transparent", ].join(";"); - // A faint highlight on hover so the affordance is visible. - grip.addEventListener("mouseenter", () => { grip.style.background = "rgba(214,255,61,.20)"; }); - grip.addEventListener("mouseleave", () => { if (!dragging) grip.style.background = "transparent"; }); + // A subtle overlay expands the pointer-catch zone without widening + // the visible band. Same click-through element, wider hit box. + grip.style.setProperty("outline", "2px solid transparent", "important"); + grip.style.setProperty("outline-offset", "1px", "important"); + grip.addEventListener("mouseenter", () => { grip.style.background = HOVER_BG; }); + grip.addEventListener("mouseleave", () => { if (!dragging) grip.style.background = IDLE_BG; }); document.body.appendChild(grip); let dragging = false; grip.addEventListener("mousedown", (e) => { @@ -59,7 +75,7 @@ window.addEventListener("DOMContentLoaded", () => { e.preventDefault(); dragging = true; document.body.style.userSelect = "none"; - grip.style.background = "rgba(214,255,61,.35)"; + grip.style.background = ACTIVE_BG; }); window.addEventListener("mousemove", (e) => { if (!dragging) return; @@ -70,7 +86,7 @@ window.addEventListener("DOMContentLoaded", () => { if (!dragging) return; dragging = false; document.body.style.userSelect = ""; - grip.style.background = "transparent"; + grip.style.background = IDLE_BG; }; window.addEventListener("mouseup", stop); window.addEventListener("mouseleave", stop);