[Windows] Fix Narrator announcing ContentView children twice when Description is set#33979
Open
praveenkumarkarunanithi wants to merge 3 commits intodotnet:mainfrom
Open
[Windows] Fix Narrator announcing ContentView children twice when Description is set#33979praveenkumarkarunanithi wants to merge 3 commits intodotnet:mainfrom
praveenkumarkarunanithi wants to merge 3 commits intodotnet:mainfrom
Conversation
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.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Root Cause
WinUI
TextBlock(used byLabel) automatically exposes itsTextto UI Automation.ContentPaneluses the defaultFrameworkElementAutomationPeer, which exposes both the parent’sAutomationProperties.Nameand all child elements. Unlike Android (NoHideDescendants) or iOS (AccessibilityElementsHidden), Windows has no single property to hide descendants while keeping the parent accessible. As a result, both Tab navigation and Browse mode announced duplicate content.Description of Change
Implemented a custom
ContentPanelAutomationPeerthat overrides three core UI Automation methods (GetAutomationControlTypeCore ,GetLocalizedControlTypeCore,GetChildrenCore) to conditionally modify behavior when Description is present.When a Description exists, the control is exposed as
AutomationControlType.Text(enables browse mode navigation; alternatives like Custom announce "custom" suffix, Group causes browse mode to skip the element), the "text" announcement suffix is suppressed via emptyGetLocalizedControlTypeCore()return, and child elements are hidden by returning null fromGetChildrenCore()to prevent duplication. When no Description is present, default behavior is preserved withAutomationControlType.Customand children remain accessible.The
HasDescriptionhelper property centralizes the non-empty Description check across all three override methods, ensuring consistent conditional logic following the MAUI `AutomationPeer patterns.Issues Fixed
Fixes #33373
Platforms Tested
Screenshots
WITHOUTFIX.1.mp4
WITHFIX.1.1.mp4