Fix editable ComboBox text contrast in Desert high-contrast theme#790
Open
amarinov-msft wants to merge 2 commits into
Open
Fix editable ComboBox text contrast in Desert high-contrast theme#790amarinov-msft wants to merge 2 commits into
amarinov-msft wants to merge 2 commits into
Conversation
Use full-contrast WindowText for the editable ComboBox in high contrast (was ~4.292:1) and place the caret at end instead of selecting all on focus, so the value isn't highlighted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
|
@amarinov-msft, I think this is more of a WPF's ComboBox style issue. We should be updating the color of TextControlSelectionHighlightColor brush in Fluent.HC.xaml. Similarly, we should try overriding the resource value in the app resources and use that instead. |
…color Fluent's high-contrast theme sets TextControlSelectionHighlightColor to WindowColor, so editable ComboBox text is washed out (unreadable) when auto-selected on focus. Override that resource with the system Highlight color under high contrast, scoped to ComboBoxPage. Keeps standard select-on-focus behavior while making the selected text legible; Light/Dark selection is unaffected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Summary
Fixes an accessibility issue in the WPF Gallery
ComboBoxpage. The editable ComboBox's focused text rendered at only ~4.292:1 contrast under the Desert contrast theme, below the 4.5:1 minimum required by MAS 4.3.1 and is flagged by Accessibility Insights. The Fluent theme draws the editable text withComboBoxForeground/ComboBoxForegroundFocused, whose Desert color pairing is borderline.Change
Sample Applications/WPFGallery/Views/BasicInput/ComboBoxPage.xaml.csOverride
ComboBoxForegroundandComboBoxForegroundFocusedto full-contrastWindowTextwhenSystemParameters.HighContrastis set, scoped to this page only. On focus, place the caret at the end instead of selecting all text, so the value isn't highlighted.Sample Applications/WPFGallery/Views/BasicInput/ComboBoxPage.xamlHook
GotKeyboardFocuson the editableComboBoxto drive the deselect behavior.Result
Under high contrast the editable
ComboBoxtext renders at the theme's fullWindowTextcolor, above the 4.5:1 minimum, so the Accessibility Insights Text Contrast check passes. Normal Light/Dark appearance is unchanged.Testing
ComboBoxunder the Desert contrast theme (now > 4.5:1, no select-all highlight).Microsoft Reviewers: Open in CodeFlow