Fix FocusOrder attribute not being respected in focus traversal#282
Merged
LittleLittleCloud merged 8 commits intomainfrom Feb 10, 2026
Merged
Fix FocusOrder attribute not being respected in focus traversal#282LittleLittleCloud merged 8 commits intomainfrom
LittleLittleCloud merged 8 commits intomainfrom
Conversation
Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix focus order issue in TextButton component
Fix FocusOrder attribute not being respected in focus traversal
Jan 14, 2026
🚀 Preview DeploymentA preview build has been generated for this PR from CI run #21815517723! Download the artifact: To view the preview locally:
🌐 Live Preview URL: https://0c5d3de8.razorconsole.pages.dev The live preview will be automatically updated when you push new |
ParadiseFallen
requested changes
Jan 21, 2026
| // Sort by focus order if specified, maintaining DOM order for elements with same/no order | ||
| targets = targets | ||
| .Select((target, index) => new { Target = target, OriginalIndex = index }) | ||
| .OrderBy(item => |
Collaborator
There was a problem hiding this comment.
OrderBy can be called multiple times. It's better to move it to select.
Also it whould be nice to mark as delegate static
Contributor
Author
There was a problem hiding this comment.
Fixed in 66ed768. Moved the FocusOrder extraction logic to the Select projection and marked all lambdas as static to improve performance.
…c to Select Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com>
ParadiseFallen
previously approved these changes
Jan 26, 2026
Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
ParadiseFallen
approved these changes
Feb 9, 2026
LittleLittleCloud
approved these changes
Feb 9, 2026
LittleLittleCloud
added a commit
that referenced
this pull request
Feb 9, 2026
* Initial plan * Fix FocusOrder attribute to sort focus targets correctly Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com> * Refactor FocusOrder logic to use static lambdas and move OrderBy logic to Select Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com> * Refactor focus order sorting in FocusManager Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com> --------- Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com> Co-authored-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
LittleLittleCloud
added a commit
that referenced
this pull request
Feb 9, 2026
* Initial plan * Fix FocusOrder attribute to sort focus targets correctly Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com> * Refactor FocusOrder logic to use static lambdas and move OrderBy logic to Select Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com> * Refactor focus order sorting in FocusManager Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com> --------- Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com> Co-authored-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
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.
Fix FocusOrder Attribute in Focus Management
This PR fixes the issue where the
FocusOrderparameter on focusable components (likeTextButtonandTextInput) is not being respected during focus traversal.Changes Made:
CollectTargetsmethod doesn't sort bydata-focus-orderCollectTargetsto sort focusable elements by FocusOrder after collectionImplementation Details:
The fix modifies the
CollectTargetsmethod inFocusManager.csto:FocusOrdervalue (lower values first) using static lambdasTest Coverage:
Added two test cases:
FocusOrder_RespectsFocusOrderAttribute: Tests sequential FocusOrder values (2, 3, 4) with out-of-order DOMFocusOrder_MixedWithoutOrderAttribute: Tests mixed scenarios with and without FocusOrder attributesThis ensures that when components like TextButton set
FocusOrder="2",FocusOrder="3", andFocusOrder="4", they will be focused in that numeric order (2, 3, 4) regardless of their position in the DOM.Original 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.