Skip to content

Fix ToolStripStatusLabel text visibility in High Contrast mode with System RenderMode#14110

Open
SimonZhao888 wants to merge 2 commits intodotnet:mainfrom
SimonZhao888:Fix_issue_13640
Open

Fix ToolStripStatusLabel text visibility in High Contrast mode with System RenderMode#14110
SimonZhao888 wants to merge 2 commits intodotnet:mainfrom
SimonZhao888:Fix_issue_13640

Conversation

@SimonZhao888
Copy link
Copy Markdown
Member

@SimonZhao888 SimonZhao888 commented Dec 4, 2025

Fixes #14098

Proposed changes

  • Modify PaintText() in ToolStripLabel class to make sure ToolStripStatusLabel text visibility in High Contrast mode with System RenderMode.

Customer Impact

  • ToolStripStatusLabel text visibility in High Contrast mode with System RenderMode.

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

RuntimeIssue.mp4

After

ToolStripLabel.mp4

Test methodology

  • Manually
Microsoft Reviewers: Open in CodeFlow

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a visibility issue with ToolStripStatusLabel text in High Contrast mode when using System RenderMode. The fix ensures that text is properly highlighted against the background, making it readable for users who rely on high contrast accessibility features.

Key Changes:

  • Moved textRect declaration earlier in the method to enable its use in the high contrast highlight logic
  • Added highlight background rendering (FillRectangle) for pressed and selected states in high contrast mode

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.15384%. Comparing base (ae5cd21) to head (6757363).
⚠️ Report is 112 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #14110         +/-   ##
===================================================
- Coverage   77.15789%   77.15384%   -0.00405%     
===================================================
  Files           3279        3279                 
  Lines         645317      645325          +8     
  Branches       47718       47720          +2     
===================================================
- Hits          497913      497893         -20     
- Misses        143717      143745         +28     
  Partials        3687        3687                 
Flag Coverage Δ
Debug 77.15384% <0.00000%> (-0.00405%) ⬇️
integration 18.99503% <0.00000%> (+0.00921%) ⬆️
production 52.01685% <0.00000%> (-0.00839%) ⬇️
test 97.40749% <ø> (ø)
unit 49.46119% <0.00000%> (-0.01528%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@ricardobossan ricardobossan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All LGTM!

LeafShi1
LeafShi1 previously approved these changes Dec 10, 2025
@KlausLoeffelmann
Copy link
Copy Markdown
Member

Hi, a couple of observations on this change:

1. Text color may not contrast with the Highlight background (ToolStripLabel.cs, Pressed/Selected branches): The fix correctly adds g.FillRectangle(SystemBrushes.Highlight, textRect) in High Contrast mode, but the text color remains ActiveLinkColor (defaults to Red) for Pressed and LinkColor/VisitedLinkColor (defaults to Blue/Purple) for Selected. These hardcoded link colors do not adapt to High Contrast themes. The established WinForms pattern (e.g., ToolStripHighContrastRenderer.OnRenderItemText) pairs SystemBrushes.Highlight backgrounds with SystemColors.HighlightText text. Since this fix targets System RenderMode where the HC renderer is not active, consider also setting textColor = SystemColors.HighlightText inside each if (DisplayInformation.HighContrast) block to guarantee sufficient contrast across all HC themes.

2. Duplicated High Contrast logic (lines ~363-366 and ~371-374): The identical if (DisplayInformation.HighContrast) { g.FillRectangle(...) } block appears in both the Pressed and Selected branches. Minor suggestion: consider extracting the fill into a shared block or combining the condition to reduce duplication.

(Copilot co-authored on Klaus' behalf.)

@LeafShi1 LeafShi1 added the waiting-review This item is waiting on review by one or more members of team label Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-area-label waiting-review This item is waiting on review by one or more members of team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Accessibility][High Contrast] The text of toolStripStatuslabel item is not visible in HC Mode when setting the RenderMode as System & Enable the IsLink

5 participants