Fix null Name on empty page header description (MAS 4.1.2)#781
Open
amarinov-msft wants to merge 1 commit into
Open
Fix null Name on empty page header description (MAS 4.1.2)#781amarinov-msft wants to merge 1 commit into
amarinov-msft wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an accessibility issue on the
Textsection'sLabelpage (and many other control pages) in WPF Gallery. The sharedPageHeaderdescriptionLabelis a focusable tab stop, but its visibility was driven byNullToVisibilityConverter, which only collapses onnull- 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.xamlLabelvisibility binding fromNullToVisibilityConverterto the existing `EmptyToVisibilityConverter, so it collapses on null, empty, or whitespace.AutomationProperties.Namebound toDescription so the description carries a meaningful Name when it is visible (mirroring theLabel`).NullToVisibilityConverterresource 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
Textpages is resolved.Microsoft Reviewers: Open in CodeFlow