Skip to content

fix: auto-focus sidebar rename inputs (#167)#179

Open
lklyne wants to merge 1 commit into
mainfrom
claude/issue-167
Open

fix: auto-focus sidebar rename inputs (#167)#179
lklyne wants to merge 1 commit into
mainfrom
claude/issue-167

Conversation

@lklyne
Copy link
Copy Markdown
Owner

@lklyne lklyne commented May 30, 2026

Closes #167

Root cause

The focus reconciler (expectedFocus) never returned { kind: 'sidebar' }, so every layout pass routed focus back to aboveView or a page view — stealing focus from the sidebar's rename input as soon as it appeared. The user's next keystroke went to the canvas rather than the input.

Fix

  • Add sidebarTextInputActive: boolean to FocusState. When true, expectedFocus returns { kind: 'sidebar' }, preventing any layout pass from stealing focus.
  • Populate the flag from isTextEditingFor(leftSidebarView.webContents) in currentFocusState(). The sidebar already reports text-input state via the existing canvas-set-text-editing IPC (wired up through useReportTextEditing), so no new renderer-side changes are needed.
  • Request a layout pass when the sidebar signals active: true so reconcileFocus() restores sidebar focus immediately if it was grabbed between the double-click and the IPC arriving.
  • Add unit tests for the new routing rules (sidebar focus, override of page focus, yield to pendingFocus).

No changes to InlineEditLabel.tsx or the sidebar renderers — the existing inputRef.current?.focus() call was correct; the bug was entirely in the main-process focus reconciler.


Generated by Claude Code

When a rename input is active in the left sidebar, the focus reconciler
was always routing back to aboveView/page on every layout pass, stealing
focus away from the sidebar input and sending keystrokes to canvas shortcuts.

- Add `sidebarTextInputActive` to FocusState; when true, expectedFocus
  returns { kind: 'sidebar' } so no layout pass can steal focus
- Populate the new field from isTextEditingFor(leftSidebarView.webContents)
  in currentFocusState() — the sidebar already reports text-input state via
  the existing canvas-set-text-editing IPC message
- Request a layout pass when the sidebar signals text-editing active so the
  reconciler immediately restores sidebar focus if it was stolen
- Add unit tests covering the new sidebar focus routing

Closes #167

https://claude.ai/code/session_01SMLwDN1wZyuo4K7WmVEHLr
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.

Auto-focus rename inputs in left sidebar so first keystroke renames

2 participants