Skip to content

Fix null Name on empty page header description (MAS 4.1.2)#781

Open
amarinov-msft wants to merge 1 commit into
microsoft:mainfrom
amarinov-msft:amarinov/empty-name
Open

Fix null Name on empty page header description (MAS 4.1.2)#781
amarinov-msft wants to merge 1 commit into
microsoft:mainfrom
amarinov-msft:amarinov/empty-name

Conversation

@amarinov-msft

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

Copy link
Copy Markdown

Summary
Fixes an accessibility issue on the Text section's Label page (and many other control pages) in WPF Gallery. The shared  PageHeader description Label is a focusable tab stop, but its visibility was driven by NullToVisibilityConverter, which only collapses on null - not on an empty string. Pages whose description is "" (Label, TextBox, TextBlock, RichTextEdit, PasswordBox, and many more) therefore rendered an empty, focusable element with a null UI Automation Name. This violates WCAG/MAS 4.1.2 (Name, Role, Value) and is flagged by Accessibility Insights as "The Name property of a focusable element must not be null."

Change
Sample Applications/WPFGallery/Controls/PageHeader.xaml

  • Switch the description Label visibility binding from NullToVisibilityConverter to the existing `EmptyToVisibilityConverter, so it collapses on null, empty, or whitespace.
  • Add AutomationProperties.Name bound to Description so the description carries a meaningful Name when it is visible (mirroring the Label`).
  • Remove the now-unused NullToVisibilityConverter resource declaration.

Result
On pages with empty description, the empty focusable element is gone. On pages with a description, the text still renders and now exposes a proper UIA Name. Screen readers no longer stop on an empty, unnamed element after the page title.

Testing

  • Built  WPFGallery.csproj  (0 errors).
  • Verified via a live UI Automation scan of the Label page that the flagged focusable null-Name text element is no longer present.
  • Confirmed in Accessibility Insights that the 4.1.2 failure on the Text pages is resolved.
Microsoft Reviewers: Open in CodeFlow

The PageHeader description Label is a focusable tab stop, but its
visibility used NullToVisibilityConverter, which only collapses on null -
not on an empty string. Pages whose description is "" (Label, TextBox,
TextBlock, RichTextEdit, PasswordBox and many others) therefore rendered
an empty, focusable element with a null UI Automation Name, flagged by
Accessibility Insights as "The Name property of a focusable element must
not be null" (MAS 4.1.2 - Name, Role, Value).

- Switch the description Label visibility to EmptyToVisibilityConverter so
  it collapses on null, empty, or whitespace, removing the empty focusable
  element entirely.
- Add AutomationProperties.Name bound to Description so the description has
  a meaningful Name when it is visible.
- Remove the now-unused NullToVisibilityConverter resource declaration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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