Skip to content

Fix UIA state announcements for CheckBox #14674

Open
LeafShi1 wants to merge 4 commits into
dotnet:mainfrom
LeafShi1:Fix_14669_CheckBoxs_don't_read_state_to_ScreenReaders
Open

Fix UIA state announcements for CheckBox #14674
LeafShi1 wants to merge 4 commits into
dotnet:mainfrom
LeafShi1:Fix_14669_CheckBoxs_don't_read_state_to_ScreenReaders

Conversation

@LeafShi1

@LeafShi1 LeafShi1 commented Jun 25, 2026

Copy link
Copy Markdown
Member

Fixes #14669

Root Cause

PropertyChange notifications raised via RaiseAutomationEvent were not reliably consumed by NVDA for this scenario.

Proposed changes

  • Use RaiseAutomationNotification for CheckBox/RadioButton state announcements in the affected path.
  • Announce explicit state text (checked, unchecked, indeterminate, pressed).
  • Move announcement text to SR resources.

Customer Impact

  • After the fix, screen-reader users get reliable and concise state announcements: Narrator no longer re-reads the full checkbox label before state, and NVDA consistently receives checked/unchecked/indeterminate/pressed updates.

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

Screen readers could miss state-change announcements in this path.

Before_change_Narrator.mp4
Before_change_NVDA.mp4

After

Screen readers consistently receives checked/not checked announcements.

After_change_Narrator.mp4
After_change_NVDA.mp4

Test methodology

  • Unit test and Manually

Test environment(s)

  • .net 11.0.0-preview.6.26317.104

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 improves accessibility state announcements for WinForms CheckBox and RadioButton by switching from UIA property-changed events to UIA Notification events, aiming for more reliable consumption by screen readers (notably NVDA) and more concise Narrator output.

Changes:

  • Update CheckBox and RadioButton to raise UIA notifications (with explicit state text) instead of UIA property-changed events in the affected paths.
  • Add new SR resource strings for the announced state text and propagate them to localized .xlf files.
  • Extend/adjust unit tests to validate that UIA notifications are raised and legacy UIA event/property-changed calls are not.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/CheckBox.cs Replaces UIA property-changed/event signaling with UIA notifications and announces explicit state text.
src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/RadioButton.cs Raises “checked” notification on check and adds “pressed” notification when clicking an already-checked radio button.
src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxTests.cs Updates assertions to expect UIA notification calls and validates notification text.
src/test/unit/System.Windows.Forms/System/Windows/Forms/RadioButtonTests.cs Updates assertions to expect UIA notification calls and adds a test for the “pressed” notification scenario.
src/System.Windows.Forms/Resources/SR.resx Adds new SR entries for announcement text; also includes an unrelated whitespace change that ripples into localization state changes.
src/System.Windows.Forms/Resources/xlf/SR.*.xlf Adds new trans-units for the announcement text and reflects a generated translation-state change for an unrelated existing string.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/System.Windows.Forms/Resources/SR.resx
@LeafShi1 LeafShi1 force-pushed the Fix_14669_CheckBoxs_don't_read_state_to_ScreenReaders branch from 2d4f33e to 87bfa20 Compare June 26, 2026 02:38
@LeafShi1 LeafShi1 changed the title Fix UIA state announcements for CheckBox and RadioButton Fix UIA state announcements for CheckBox Jun 26, 2026
@LeafShi1

Copy link
Copy Markdown
Member Author

The changes in this PR enable both Narrator and NVDA to correctly announce state changes for the CheckBox. However, the monitoring of PropertyChange events by Accessibility Insights has been removed, here is my assessment:

Native Win32 CheckBox controls do not themselves raise the specific PropertyChange event expected by Accessibility Insights; instead, they operate via standard MSAA + UIA mapping mechanisms. Therefore, aligning this implementation with the behavior of native controls is reasonable. The fact that actual screen readers (Narrator, NVDA) function correctly indicates that the event sequence is correct.

Recording.2026-06-26.173702.mp4

@KlausLoeffelmann What do you think?

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.

CheckBoxs do not read their state to screen readers properly on change

2 participants