microsoft / microsoft/microsoft-ui-xaml
Focus Border Behavior Differs Between Windows App SDK 1.5 and 1.6
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
Describe the bug
The behavior of focus borders has changed between Windows App SDK versions 1.5 and 1.6.
In Windows App SDK 1.5, when a control (e.g., a button) placed inside a ScrollViewer gains focus via the keyboard, clicking outside the control dismisses the focus border, indicating that the control has lost focus.
In Windows App SDK 1.6, the same action does not dismiss the focus border. Even after clicking outside the control, the focus border remains visible, indicating that the control retains focus.
This behavior change affects how focus is visually managed and may lead to inconsistencies in user experience, especially in scenarios relying on traditional focus dismissal behavior.
Steps to reproduce the bug
- Create a WinUI 3 application.
- Ensure that the installed Windows App SDK version is 1.6. If not, update to 1.6.
- In MainWindow.xaml file, replace the existing code with following code .
<ScrollViewer>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="20">
<CheckBox Content="Two-state CheckBox"/>
<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
</StackPanel>
</ScrollViewer>
- Build and run the application.
- Use the keyboard to focus on the control(e.g., a button) .
- Click outside the control using the mouse.
Sample projects with Windows App SDK 1.5 and 1.6 attached to reproduce the issue.
Apps.zip
Expected behavior
The focus border around the control should be dismissed, indicating the loss of focus (as in Windows App SDK 1.5).
Actual Behavior
The focus border remains visible around the control, even after clicking outside (as in Windows App SDK 1.6).
Screenshots
No response
NuGet package version
Windows App SDK 1.6.3: 1.6.241114003
Packaging type
Packaged (MSIX), Unpackaged
Windows version
Windows 10 version 22H2 (19045, 2022 Update)
IDE
Visual Studio 2022
Additional context
If this is intentional, guidance on managing focus dismissal would be appreciated.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached Apps.zip and reproduce the behavior using the MainWindow.xaml markup in the issue under Windows App SDK 1.5 and 1.6. Compare keyboard focus followed by an outside mouse click, and consider the issue done when the 1.6 behavior is explained or corrected to match the stated expected focus-border dismissal.
Written by the indexing model from the issue text.
Assessment
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100