Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request addresses high contrast (HC) accessibility issues by implementing proper theming for buttons and headers. The changes ensure that UI elements display correctly in high contrast mode by providing appropriate color brushes for different visual states.
- Backported complete
SubtleButtonStylefrom WASDK1.8 with proper high contrast brush support - Added explicit foreground color brushes for the home page header across all theme modes
- Enhanced button styling with proper border brush definitions and visual state management
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| WinUIGallery/Styles/Button.xaml | Implements comprehensive theming dictionaries for SubtleButtonStyle with HC-specific brushes and enhanced visual states |
| WinUIGallery/Controls/HomePage/HomePageHeader.xaml | Adds fixed foreground color brushes for header text elements across Light, Dark, and HighContrast themes |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| <StaticResource x:Key="SubtleButtonBackground" ResourceKey="SubtleFillColorTransparentBrush" /> | ||
| <StaticResource x:Key="SubtleButtonBackgroundPointerOver" ResourceKey="SubtleFillColorSecondaryBrush" /> | ||
| <StaticResource x:Key="SubtleButtonBackgroundPressed" ResourceKey="SubtleFillColorTertiaryBrush" /> | ||
| <StaticResource x:Key="SubtleButtonBackgroundDisabled" ResourceKey="SubtleFillColorTransparentBrush" /> | ||
| <StaticResource x:Key="SubtleButtonForeground" ResourceKey="TextFillColorPrimaryBrush" /> | ||
| <StaticResource x:Key="SubtleButtonForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush" /> | ||
| <StaticResource x:Key="SubtleButtonForegroundPressed" ResourceKey="TextFillColorSecondaryBrush" /> | ||
| <StaticResource x:Key="SubtleButtonForegroundDisabled" ResourceKey="TextFillColorDisabledBrush" /> | ||
| <StaticResource x:Key="SubtleButtonBorderBrush" ResourceKey="SubtleFillColorTransparentBrush" /> | ||
| <StaticResource x:Key="SubtleButtonBorderBrushPointerOver" ResourceKey="SubtleFillColorSecondaryBrush" /> | ||
| <StaticResource x:Key="SubtleButtonBorderBrushPressed" ResourceKey="SubtleFillColorTertiaryBrush" /> | ||
| <StaticResource x:Key="SubtleButtonBorderBrushDisabled" ResourceKey="SubtleFillColorTransparentBrush" /> |
There was a problem hiding this comment.
Why exactly do we need to add all of those brushes just to fix the red background in HC?
There was a problem hiding this comment.
I don't really know 😅.. I think it has to do with that we were referring to existing brushes in WinUI that do not have a HC version (only light/dark).
I've now copied the SubtleButtonStyle from WinUI that has this properly set up.
When we upgrade to 1.8 we can remove this style + folks that want to copy it into their own app have a style that adheres to the WinUI styles convention.
There was a problem hiding this comment.
A simpler fix would be to not reference colors but brushes (and appending brush to the SubtleX colors for background actually fixes it). Colors in WinUI for some reason tend to point to a Red color in High Contrast, dont ask me why. Not a big fan of copying the entire style but I guess its just temporary.
|
/azp run |
SubtleButtonStylecoming in WASDK1.8 so the right brushes are used in HC modeFixes #1952
Fixes #1878
Before:

After:
