Fix FocusManager to auto-focus next element when current element is removed#108
Merged
LittleLittleCloud merged 16 commits intomainfrom Nov 16, 2025
Merged
Conversation
Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com>
Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix focus manager to handle element removal
Fix FocusManager to auto-focus next element when current element is removed
Nov 7, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds automatic refocusing behavior to the FocusManager when the currently focused element is removed from the VDOM. The changes track the session's cancellation token and trigger focus adjustments asynchronously when the observer detects structural changes.
- Stores
_sessionCtsto access cancellation tokens outside the session initialization - Modifies
OnNextto detect when the focused element is removed and automatically refocus to the first available element - Adds two test cases covering automatic refocusing and focus clearing scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/RazorConsole.Core/Focus/FocusManager.cs | Added _sessionCts field to track session cancellation token; modified OnNext to fire async focus changes via Task.Run when elements are removed |
| src/RazorConsole.Tests/FocusManagerTests.cs | Added tests for automatic refocusing when focused element is removed and for clearing focus when all elements are removed |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
…terTranslator for enhanced debugging
…sTarget structure
… for VNode equality
…ement; update BackgroundColor handling in App component
Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com>
Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com>
…ample Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com>
Member
|
@copilot fix format |
Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com>
Contributor
Author
LittleLittleCloud
approved these changes
Nov 16, 2025
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.
Recent Changes
KeyboardEventManager.csOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.