fix: auto-focus sidebar rename inputs (#167)#179
Open
lklyne wants to merge 1 commit into
Open
Conversation
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
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #167
Root cause
The focus reconciler (
expectedFocus) never returned{ kind: 'sidebar' }, so every layout pass routed focus back toaboveViewor 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
sidebarTextInputActive: booleantoFocusState. When true,expectedFocusreturns{ kind: 'sidebar' }, preventing any layout pass from stealing focus.isTextEditingFor(leftSidebarView.webContents)incurrentFocusState(). The sidebar already reports text-input state via the existingcanvas-set-text-editingIPC (wired up throughuseReportTextEditing), so no new renderer-side changes are needed.active: truesoreconcileFocus()restores sidebar focus immediately if it was grabbed between the double-click and the IPC arriving.pendingFocus).No changes to
InlineEditLabel.tsxor the sidebar renderers — the existinginputRef.current?.focus()call was correct; the bug was entirely in the main-process focus reconciler.Generated by Claude Code