Let typing follow Ctrl+N without a click - #555
Merged
Merged
Conversation
The attach handler focused the editor synchronously, mid-event, while the tab strip and window were still arbitrating focus - so whatever ran after the handler won, and the first keystrokes into a fresh query tab landed nowhere until something was clicked. The same in a real window on Avalonia 11 and 12; invisible headlessly, because no arbitration runs there. Focusing one Loaded-priority hop later lands after the layout pass and sticks. Focus() on a control whose tab was switched away before the post fires is a benign no-op in both Avalonia lines (no visual root means no focus manager means false, not a throw), so the deferral needs no guard. The other FocusEditor call sites run from input handlers after arbitration settles and stay synchronous. Drive-verified both directions: fresh launch, Ctrl+N, immediate typing - lost before the change, colorized in the editor after it. Fixes #551 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sr43FouJ6RizUyoWQeR5FX
|
Reviewed. This is a minimal, well-scoped fix — deferring Checked:
No blocking issues. |
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.
Fixes #551. FocusEditor ran synchronously inside AttachedToVisualTree, where the tab strip and window are still arbitrating focus — the later claimant won, and the first keystrokes after Ctrl+N vanished until a click. Present on Avalonia 11 (reproduced on the installed 1.25 build) and 12 alike; headless tests can't see it because no focus arbitration runs there. The fix defers the focus one Loaded-priority hop. Gotcha review clean, including the detach race: Focus() without a visual root is a verified no-op in both Avalonia lines, so no guard is needed, and the suite's focus assertions all sit on untouched synchronous paths (full suite 713 passed / 1 known skip). Drive-verified: Ctrl+N then immediate typing lands colorized with zero clicks.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Sr43FouJ6RizUyoWQeR5FX