Fix focus issues with ContentDialog #931
Merged
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.
Pull request type
What is the current behavior?
Currently, ContentDialog has 2 focus issues (that can be observed in the wpfui gallery). 1. On launching ContentDialog focus is not on content dialog, it stays on the background controls. 2. One can tab off the ContentDialog controls onto background controls.
Issue Number: N/A
What is the new behavior?
It now behaves like WinUI 3 - i.e. it has focus starting on the ContentDialog and one cannot tab off ContentDialog (it cycles within the dialog). Note that there was an attempt to Focus() dialog on load, but since ContentDialog was not set to focusable that call returned false (and did nothing). This is now fixed.
Other information
This is just a candidate solution. If one does not want ContentDialog set to Focusable for whatever reason, then they can write a routine to select the first focusable child.