Skip to content

fix(terminal): own Shift+Tab explicitly to stop chrome-focus shading - #11

Merged
ohernandezdev merged 1 commit into
mainfrom
fix/shift-tab-explicit-handling
Jul 27, 2026
Merged

fix(terminal): own Shift+Tab explicitly to stop chrome-focus shading#11
ohernandezdev merged 1 commit into
mainfrom
fix/shift-tab-explicit-handling

Conversation

@ohernandezdev

Copy link
Copy Markdown
Owner

Summary

Follow-up to #10, which fixed Shift+Tab from opening the file preview panel (removed its buttons from the tab order). That fix left the underlying cause still live: xterm.js leaves Shift+Tab uncancelled on purpose (so app-level chords like Claude Code's plan-mode toggle still reach the pty), so the browser's native reverse-tab-order focus navigation still ran on every Shift+Tab — it just landed on the next focusable chrome button instead of the preview panel (confirmed live: the window's own close button lit up with a focus ring).

Since the app never wants Shift+Tab to move focus around its own chrome while a terminal has it, this handles the chord explicitly in attachCustomKeyEventHandler: preventDefault() + send the same CSI Z sequence xterm would have sent, so the hotkey still reaches the pty with zero focus side-effect.

Verification

Confirmed live via an isolated test build (separate Tauri identifier, CDP + Playwright): before, document.activeElement moved to a chrome button after a real Shift+Tab keystroke; after, it stays on the terminal's own textarea, no console errors.

Test plan

  • In a Claude Code tab, press Shift+Tab — plan-mode toggle still works, no button anywhere in the titlebar shows a focus ring

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
https://claude.ai/code/session_01GHgSVKPsaWRfuJMo1rc2AN

…rough

The tabindex fix stopped Shift+Tab from landing on the (now unreachable)
preview panel buttons, but the underlying cause was still live: xterm.js
leaves Shift+Tab uncancelled on purpose, so the browser's native reverse-
tab-order focus navigation still ran on every Shift+Tab keystroke — it
just landed on the next focusable chrome button instead (confirmed live:
the window's own close button lit up with a focus ring). Since the app
never wants Shift+Tab to move focus around its own chrome while a
terminal has it, handle the chord explicitly: preventDefault it and send
the same CSI Z sequence xterm would have sent ourselves. The hotkey (e.g.
Claude Code's plan-mode toggle) still reaches the pty with zero focus
side-effect — confirmed live, activeElement stays on the terminal's own
textarea through the keystroke.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GHgSVKPsaWRfuJMo1rc2AN
@ohernandezdev
ohernandezdev merged commit 6cbe9d4 into main Jul 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant