XYFocus should skip effectively disabled controls #20241
+41
−1
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?
Changes XYFocus.IsValidCandidate to check IsEffectivelyEnabled and IsEffectivelyVisible instead of IsEnabled and IsVisible
What is the current behavior?
When a control is effectively disabled (for example a Button bound to a Command with CanExecute = false) XYFocus will still consider it a valid candidate. If such a control ends up being the best candidate it turns into a focus roadblock as it cannot actually be focused.
What is the updated/expected behavior with this PR?
Controls that are disabled by means other than changing IsEnabled are skipped for XYFocus, preventing them from blocking navigation.
How was the solution implemented (if it's not obvious)?
XYFocus.IsValidCandidate() was changed to check IsEffectivelyEnabled and IsEffectivelyVisible instead of IsEnabled and IsVisible
Checklist
Breaking changes
Behavioural changes if effectively disabled controls were being used as navigation blockers.
Obsoletions / Deprecations
None
Fixed issues
Fixes #20239
Notes
I am a little concerned by IsValidFocusSubtree.
It says effective values are checked, but I can't see where (other than the changes I have just made). This does seem to be related to focus engagement though, which as far as I know isn't implemented.