Repository navigation
Return false by default from FocusManager.CanHaveFocusableChildren - #21640
Merged
Conversation
freddiesmartbox
force-pushed
the
Issue21620-FocusManager-CanHaveFocusableChildren-Partial-Fix
branch
from
June 24, 2026 10:25
c2c5dc3 to
afef661
Compare
|
You can test this PR using the following package version. |
Collaborator
|
Contributor
Author
|
(awaiting confirmation from employer re cla) |
freddiesmartbox
force-pushed
the
Issue21620-FocusManager-CanHaveFocusableChildren-Partial-Fix
branch
from
June 25, 2026 10:00
afef661 to
f11b583
Compare
Contributor
Author
|
@cla-avalonia agree |
Importantly, this will return false for controls that are not focusable (e.g. TextBlock) or that have no focusable childen (e.g. an empty StackPanel)
freddiesmartbox
force-pushed
the
Issue21620-FocusManager-CanHaveFocusableChildren-Partial-Fix
branch
from
June 26, 2026 07:14
f11b583 to
7f5c7b5
Compare
|
You can test this PR using the following package version. |
MrJul
added this pull request to the merge queue
Jul 3, 2026
freddiesmartbox
deleted the
Issue21620-FocusManager-CanHaveFocusableChildren-Partial-Fix
branch
July 3, 2026 11:24
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.
What does the pull request do?
FocusManager.CanHaveFocusableChildrento returnfalseby default.FocusManagerto check that it can successfully navigate past un-focusable controlsWhat is the current behavior?
Current behaviour is that some controls (e.g. empty StackPanels and TextBlocks) which should be skipped cause the search for a candidate to fail because
FocusHelpers.CanHaveFocusableChildrenincorrectly returnstruefor them.What is the updated/expected behavior with this PR?
FocusManagershould correctly skip unfocusable elements.How was the solution implemented (if it's not obvious)?
FocusHelpers.CanHaveFocusableChildrenappears to incorrectly returntruefor all non-null parameters. It looks like the intention was to default tofalseand then only returntrueif a positive condition is met (supported not only by the fact that the current behaviour makes no sense, but by thebreakcondition at the end of the loop). This is implemented.Checklist
FocusHelpersclass itself or other methods that depend onFocusHelpers.CanHaveFocusableChildrenif desirableBreaking changes
Behaviour of
FocusHelpers.CanHaveFocusableChildrenis dramatically changed; likely that existing code relying on it is not working as expected currently.Obsoletions / Deprecations
N/A
Fixed issues
Fixes #21620