Skip to content

fix: inactive overlay z-index broken by JS-style comment in CSS#215

Merged
j4rviscmd merged 1 commit into
mainfrom
fix/fix-overlay-zindex
Jun 24, 2026
Merged

fix: inactive overlay z-index broken by JS-style comment in CSS#215
j4rviscmd merged 1 commit into
mainfrom
fix/fix-overlay-zindex

Conversation

@j4rviscmd

Copy link
Copy Markdown
Owner

Problem

The inactive window overlay (added in #213) was invisible in production builds. When the window lost focus, the overlay element was created and coderm-inactive-overlay-visible was applied, but it stayed hidden behind the workbench.

Root Cause

The overlay CSS is injected via a template literal. The z-index: 10000 declaration was preceded by JS-style // Why: comments:

.coderm-inactive-overlay {
    ...
    // Why: 10000 deliberately sits above every standard VS Code layer
    // (modal editor backdrop=2540, ...)
    z-index: 10000;
}

CSS only recognizes /* */ comments. The parser treated // as an invalid token and discarded the entire declaration up to the next ; — which was the z-index: 10000; terminator. As a result z-index fell back to auto (≈0), and since .monaco-workbench has z-index: 1, the overlay rendered behind the workbench and was never visible.

This only surfaced in production: the dev build's simpler stacking context let z-index: auto still appear on top, but the full production workbench creates a z-index: 1 stacking context that hid the overlay.

Fix

Convert the // Why: lines to CSS-valid /* Why: ... */ so the parser no longer discards z-index: 10000.

Verification

  • DevTools (CDP): z-index computed value went from auto10000 after the fix
  • Overlay now renders above the workbench when the window loses focus (confirmed in dev build)

🤖 Generated with Claude Code

The CSS template literal used // Why: line comments, which CSS does not treat as comments. The parser discarded the following z-index: 10000 declaration, leaving the overlay at z-index: auto and hidden behind the workbench (.monaco-workbench has z-index: 1). Convert to /* Why: ... */ so z-index: 10000 applies and the overlay renders above the workbench in production builds.

Co-Authored-By: Claude <noreply@anthropic.com>
@j4rviscmd j4rviscmd added the bug Something isn't working label Jun 24, 2026
@j4rviscmd j4rviscmd merged commit 46134a6 into main Jun 24, 2026
3 checks passed
@j4rviscmd j4rviscmd deleted the fix/fix-overlay-zindex branch June 24, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant