Skip to content

Enlarge WPF Gallery nav chevron to meet 3:1 non-text contrast#780

Open
amarinov-msft wants to merge 1 commit into
microsoft:mainfrom
amarinov-msft:amarinov/contrast-issues
Open

Enlarge WPF Gallery nav chevron to meet 3:1 non-text contrast#780
amarinov-msft wants to merge 1 commit into
microsoft:mainfrom
amarinov-msft:amarinov/contrast-issues

Conversation

@amarinov-msft

@amarinov-msft amarinov-msft commented Jun 25, 2026

Copy link
Copy Markdown

Summary
Fixes an accessibility issue in the WPF Gallery navigation pane. The expand/collapse chevron on TreeViewItem rendered at only ~2.6:1 contrast against the pane background, below the 3:1 minimum required by MAS 1.4.11 - Non-text Contrast and is flagged by Accessibility Insights. The default Fluent theme draws the chevron with a very thin FontSize 10 glyph whose anti-aliased strokes never reach full color. The chevron's size is baked into the sealed theme template via StaticResource, so it cannot be corrected with app-level resource overrides.

Change
Sample Applications/WPFGallery/MainWindow.xaml.cs
Enlarge the navigation chevron glyph from FontSize 10 to FontSize 12 in code-behind. The fix walks each realized nav TreeViewItem (including children generated lazily on expand) and sets the chevron's FontSize directly. The glyph keeps the inherited primary text brush (no color or weight change), so the heavier strokes now render at full color while preserving the original subtle appearance.

Result
The chevron now renders #797979 on #F3F3F3 = 3.92:1, up from ~2.6:1, passing the 3:1 requirement. The Accessibility Insights Non-Text Contrast check passes, and the chevron remains a subtle gray rather than a heavy black.

Testing

  • Built WPFGallery.csproj (0 errors).
  • Measured the rendered chevron contrast at 3.92:1
  • Verified in System, Light and Dark theme
Microsoft Reviewers: Open in CodeFlow

@amarinov-msft

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Microsoft"

@amarinov-msft amarinov-msft force-pushed the amarinov/contrast-issues branch from e63a44f to 12aae6e Compare June 26, 2026 09:55
@amarinov-msft amarinov-msft changed the title Fix low-contrast TreeViewItem chevron in WPF Gallery nav pane Enlarge WPF Gallery nav chevron to meet 3:1 non-text contrast Jun 26, 2026
@amarinov-msft amarinov-msft force-pushed the amarinov/contrast-issues branch from 12aae6e to d466cb9 Compare June 26, 2026 10:36
The Fluent nav TreeView expand/collapse chevron renders as a thin FontSize-10 glyph whose anti-aliased strokes only reach ~2.6:1 against the nav background, below the WCAG/MAS 1.4.11 3:1 non-text contrast minimum. The glyph size is baked into the sealed theme template via a StaticResource and cannot be overridden through application resources, so the chevron FontSize is enlarged on each realized nav container in code-behind, rendering the full stroke at ~3.9:1 in every theme.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@amarinov-msft amarinov-msft force-pushed the amarinov/contrast-issues branch from d466cb9 to 435f447 Compare June 26, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant