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.
Description
Current observations with regards to creating a Composite Button out of a "Content View" that works with keyboard
Currently MAUI doesn't propagate
Focuschanges from a basicMauiViewup to the xplat code. I've created an issue here so that if focus behavior has been enabled then you can use a VSM for style changes. I've hacked around this in this PR for now to demonstrate the behaviorGenerally a
Content Viewworks fine for keyboard navigation if you've setup the expectations correctly. If you add aSemanticDescriptionto a contentview this causes it to become part of the accessibility tree. This means that if you enable basic keyboard enhancement features on MAC you'll be able to navigate to theContent Viewwith a keyboard.As a note, this is also how
UIButtonworks.If you build a basic swift app, you won't be able to navigate to this button.
Once you enable Keyboard Navigation in the Keyboard Settings on your mac (Settings => Keyboard => Keyboard SEttings => Keyboard Navigation) then it works fine.
ContentViewwithout enabling Keyboard Navigation you can override the "CanBecomeFocused" property on theContentViewand return true. This is not really recommended though because other interactive controls aren't going to work like this either. For example, any native control (UIButton) will still be unreachable with a keyboard unless you enable keyboard navigation.