Skip to content

Fix DarkMode (a) StatusStrip background renderer A11Y Regression. #13360

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

KlausLoeffelmann
Copy link
Member

@KlausLoeffelmann KlausLoeffelmann commented Apr 23, 2025

Fixes #12909.
Fixes #12663.
Fixes #12041.
Fixes #12040.
Fixes #12027.

Microsoft Reviewers: Open in CodeFlow

Copy link

codecov bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.57018%. Comparing base (330a7c6) to head (85d701e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13360         +/-   ##
===================================================
- Coverage   62.58082%   62.57018%   -0.01065%     
===================================================
  Files           1560        1560                 
  Lines         159763      159763                 
  Branches       14915       14915                 
===================================================
- Hits           99981       99964         -17     
- Misses         59007       59024         +17     
  Partials         775         775                 
Flag Coverage Δ
Debug 62.57018% <ø> (-0.01065%) ⬇️
integration 11.32273% <ø> (-0.00525%) ⬇️
production 40.74266% <ø> (-0.01766%) ⬇️
test 95.69342% <ø> (ø)
unit 38.12901% <ø> (-0.01038%) ⬇️

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@KlausLoeffelmann KlausLoeffelmann force-pushed the DarkMode_a_FixStatusStripRegression branch 2 times, most recently from cd504d7 to 504b21a Compare May 5, 2025 22:35
@KlausLoeffelmann KlausLoeffelmann force-pushed the DarkMode_a_FixStatusStripRegression branch from 8e9ff57 to 5ea89b6 Compare May 6, 2025 13:27
Copy link

@Copilot 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 addresses several A11Y regressions related to DarkMode rendering by removing experimental diagnostic attributes and refining related rendering logic. Key changes include the removal of experimental DarkMode attributes in form APIs, the introduction and integration of a dedicated dark mode renderer in ToolStripSystemRenderer, and various rendering improvements in ToolStripRenderer and StatusStrip.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
FormCornerPreference.cs Removed experimental diagnostic attribute for DarkMode support.
Form.cs Removed experimental attribute on DarkMode–related properties and events.
ToolStripSystemRenderer.cs Introduced a dedicated dark mode renderer and updated RendererOverride logic.
ToolStripRenderer.cs Updated rendering paths and optimized array initializations for DarkMode disabled images.
ToolStrip.cs Modified background painting to use renderer overrides when available.
StatusStrip.cs Updated comment spelling for clarity.
PublicAPI.Unshipped.txt Updated API documentation entries for FormCornerPreference and related events.
Comments suppressed due to low confidence (6)

src/System.Windows.Forms/System/Windows/Forms/FormCornerPreference.cs:11

  • Verify that the removal of the experimental DarkMode diagnostic attribute is intended and that any related tooling or documentation has been updated accordingly.
-[Experimental(DiagnosticIDs.ExperimentalDarkMode, UrlFormat = DiagnosticIDs.UrlFormat)]

src/System.Windows.Forms/System/Windows/Forms/Form.cs:2185

  • Ensure that removing the experimental attribute from the Form properties aligns with production readiness for DarkMode, and update any related diagnostic handling as needed.
-    [Experimental(DiagnosticIDs.ExperimentalDarkMode, UrlFormat = DiagnosticIDs.UrlFormat)]

src/System.Windows.Forms/System/Windows/Forms/Controls/ToolStrips/StatusStrip.cs:121

  • Correct the spelling of 'accomodate' to 'accommodate' in the comment for clarity.
// we do some custom stuff with padding to accomodate size grip.

src/System.Windows.Forms/System/Windows/Forms/Controls/ToolStrips/ToolStripSystemRenderer.cs:18

  • Confirm that prioritizing high contrast mode over dark mode in the RendererOverride is intended and that the newly introduced dark mode renderer meets accessibility guidelines.
+    private ToolStripRenderer? _toolStripDarkModeRenderer;

src/System.Windows.Forms/System/Windows/Forms/Controls/ToolStrips/ToolStripRenderer.cs:855

  • Review the logic change for rendering item check images to ensure that returning early when the image rectangle is empty or the image is null does not inadvertently skip intended rendering in edge cases.
+        if (imageRect == Rectangle.Empty || image is null)

src/System.Windows.Forms/System/Windows/Forms/Controls/ToolStrips/ToolStrip.cs:3651

  • [nitpick] Ensure that using the renderer override to draw the ToolStrip background and returning early does not conflict with any custom rendering requirements that downstream consumers might have.
+            if (Renderer.RendererOverride is ToolStripRenderer renderer)

@KlausLoeffelmann KlausLoeffelmann force-pushed the DarkMode_a_FixStatusStripRegression branch from 31d85bf to 3e3ed3f Compare May 8, 2025 06:19
@KlausLoeffelmann KlausLoeffelmann force-pushed the DarkMode_a_FixStatusStripRegression branch from 3a1b788 to 031811f Compare May 8, 2025 07:02
@KlausLoeffelmann KlausLoeffelmann added this to the 10 Preview5 milestone May 8, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment