Skip to content

Keep keyboard focus in the focused pane on sidebar clicks - #458

Merged
amirlehmam merged 1 commit into
amirlehmam:masterfrom
strayge:fix/sidebar-keep-pane-focus
Nov 15, 2026
Merged

amirlehmam merged 1 commit into
amirlehmam:masterfrom
strayge:fix/sidebar-keep-pane-focus

Conversation

@strayge

@strayge strayge commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Problem

Clicking the sidebar takes keyboard focus away from the focused pane while the pane keeps its focus ring.
After clicking the active workspace's row, an empty part of the sidebar, typing goes nowhere until the pane is clicked again.

Nothing in the sidebar uses the keyboard apart from its text fields, so the click just leaves focus on the page body. The terminal only grabs focus back when its pane becomes visible or focused, and clicking the workspace you're already in changes neither.

Change

Sidebar/keep-pane-focus.ts, wired as the sidebar root's onMouseDown:

  • Presses outside workspace rows have their default cancelled, so focus never leaves the pane. The terminal sees no blur, and an app that has turned on focus reporting gets no focus-out/focus-in pair. Clicks still fire.
  • Workspace rows are draggable, and cancelling the press also cancels Chromium's native drag, which is how rows are reordered. On a row the press keeps its default, and focus is handed back once the press ends (mouseup or dragend). It only goes back to an element still inside the focused pane, so a click that switched the workspace or the pane leaves focus where that switch put it.
  • Text fields (rename, session name) and the explorer docked in the sidebar keep normal focus.

Testing

  • npm test: 415 files passed, 2 skipped; 6705 tests passed, 10 skipped. Includes the new tests/unit/sidebar-keep-pane-focus.test.ts.
  • npm run typecheck and eslint on src/renderer/components/Sidebar are clean.
  • Checked by hand in wmux:
    • Dragging workspaces to reorder them works.
    • After clicking the active workspace row, typing goes into the terminal.

Clicking the sidebar moved focus off the terminal while the pane kept its
focus ring, so typing afterwards went nowhere. Presses outside workspace
rows now cancel the focus change; rows keep their default so native drag
reordering still works, and focus is handed back to the focused pane when
the press ends.
@amirlehmam
amirlehmam merged commit b4003ba into amirlehmam:master Nov 15, 2026
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.

2 participants