cmux NEXT Inspector: its own close button, and Esc closes it
Leo, 2026-10-22: "why does it FLICKER AND WHY DOES IT STAY ON IN THESE RANDOM SITUATIONS WITHOUT BEING CLOSABLE!?" His screenshot shows an in-pane diff with the Inspector over it, and nothing to close it.
This PR makes the Inspector closable everywhere. The ceiling (#24125) and the flicker are separate PRs.
Cause. The Inspector's only close was its toggle in the chat header. Over a diff in place, below a 1160px stage, the header is hidden (.acpmux-reviewing > .acpmux-header { visibility: hidden }) and the DiffPanel covers it. So the toggle was out of reach, and there was no Esc.
Fix.
- The panel has a head with its name and a close button (
chatInspector.close, "Close Inspector", in all 21 locales). - Esc closes it from anywhere except a text field, so the composer keeps its own Esc. The listener is on the document, so it runs before DiffPanel's Esc on the window: the first Esc closes the Inspector, the next closes the diff.
- Open state stays per viewer, as before.
Test (red first). webviews/test/chat-inspector-overlay-toggle.test.ts, "the Inspector's own close button and Esc close it; Esc in the composer leaves it open", in real Chromium and WebKit, with the header hidden as over a diff:
- Red at base: there was no close button.
- Green: all 8 tests in the file pass, along with the inspector unit, motion, reveal and tasks tests (49 pass).
Capture. The webview gallery run in CI attaches screenshots. The head row sits above Environment.
🤖 Generated with Claude Code
Agent session: huge-blue
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
The cmux NEXT Inspector now has its own close button and an Esc handler, so it can be closed even when a diff hides the chat header that previously held its only toggle.
- Adds a panel head with a title and a localized close button.
- Esc closes it from anywhere except a text field, so the composer keeps its own Esc; the Inspector listens on the document, before the DiffPanel's Esc on the window, so the first Esc closes the Inspector and the next closes the diff.
- An open popover, menu, or dialog takes Esc first, leaving the Inspector open.
- Tests cover the close button and the Esc behavior with the header hidden, in the composer, and under a popover.