Skip to content

Expose TextBox/NumberBox/AutoSuggestBox clear button to Voice Access - #11639

Closed
Harini Malothu (HariniMalothu17) wants to merge 1 commit into
microsoft:mainfrom
HariniMalothu17:fix/voiceaccess-clear-button-7996
Closed

Expose TextBox/NumberBox/AutoSuggestBox clear button to Voice Access#11639
Harini Malothu (HariniMalothu17) wants to merge 1 commit into
microsoft:mainfrom
HariniMalothu17:fix/voiceaccess-clear-button-7996

Conversation

@HariniMalothu17

Copy link
Copy Markdown

Summary

Fixes the Voice Access issue where the TextBox / NumberBox / AutoSuggestBox inline clear (x) button could not be targeted by a number tag.

When the inline clear button is shown (for example a NumberBox with SpinButtonPlacementMode="Inline"), the button clears the entered text. It is a real named Button that already receives a localized UIA name ("Delete"). However, the template explicitly set AutomationProperties.AccessibilityView="Raw" on that DeleteButton, which excludes the element from the UIA Content view. Voice Access "Show numbers" only tags elements in the Content view, so the clear button never received a number tag and could not be targeted hands-free.

Repro (from #7996)

  1. Open the Gallery > NumberBox.
  2. Change SpinButton placement to Inline.
  3. Click in the "Enter an integer" number box and type a value.
  4. Turn on Voice Access and say "Show numbers".
  5. Observe that numbers appear on the input area and the up/down arrows, but not on the clear (x) button.

What changed

Removed the explicit AutomationProperties.AccessibilityView="Raw" from the DeleteButton in every affected template, reverting it to its default Content accessibility view. Because the button remains Visibility="Collapsed" (only shown in the ButtonVisible visual state) and keeps IsTabStop="False", it is exposed to Voice Access only while it is actually visible, and keyboard tab order is unchanged.

  • controls/dev/CommonStyles/TextBox_themeresources.xaml — removed AccessibilityView="Raw" from the DeleteButton in the default TextBox template.
  • controls/dev/CommonStyles/TextBox_themeresources_perf2026.xaml — same change in the perf2026 TextBox template copy.
  • controls/dev/NumberBox/NumberBox.xaml — removed AccessibilityView="Raw" from the DeleteButton in the inner NumberBox TextBox style.
  • controls/dev/NumberBox/NumberBox_perf2026.xaml — same change in the perf2026 NumberBox template copy.
  • controls/dev/AutoSuggestBox/AutoSuggestBox_themeresources.xaml — removed AccessibilityView="Raw" from the DeleteButton.
  • controls/dev/AutoSuggestBox/AutoSuggestBox_themeresources_perf2026.xaml — same change in the perf2026 AutoSuggestBox template copy.

Tests

  • controls/dev/NumberBox/InteractionTests/NumberBoxTests.cs — added VerifyClearButtonIsAccessible: switches NumberBox to inline mode, enters a value so the clear button is visible, and verifies the "Delete" button is exposed to UIA (found in the inner TextBox subtree), distinct from the Increase/Decrease spin buttons, then invokes it and checks the text is cleared.
  • controls/dev/CommonStyles/InteractionTests/CommonStylesTests.cs — added TextBoxClearButtonIsAccessibleTest: focuses a TextBox so the clear button is visible and verifies the "Delete" button is exposed to UIA and clears the text when invoked.
  • controls/dev/CommonStyles/TestUI/TextControlsPage.xaml — named the test TextBox so the new test can find it.

Fixes #7996

The inline clear ("Delete") button shown by TextBox, NumberBox, and
AutoSuggestBox could not be targeted by Voice Access "Show numbers". The
template set AutomationProperties.AccessibilityView="Raw" on that button,
which removes it from the UIA Content view, and Voice Access only tags
elements in the Content view.

Remove the explicit AccessibilityView="Raw" from the DeleteButton in every
affected template so it reverts to the default Content view. The button
remains Visibility="Collapsed" (shown only in the ButtonVisible visual
state) and keeps IsTabStop="False", so it is exposed to Voice Access only
while it is actually visible and keyboard tab order is unchanged.

Add interaction tests verifying the visible clear/Delete button is exposed
(and invocable) for NumberBox inline mode and for TextBox, distinct from the
Increase/Decrease spin buttons.

Fixes microsoft#7996
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2620f9d2-ff0f-45b0-aa36-3626abe3e83a
@microsoft-github-policy-service microsoft-github-policy-service Bot added the needs-triage Issue needs to be triaged by the area owners label Aug 25, 2026
@HariniMalothu17

Copy link
Copy Markdown
Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

@harshit7962

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

@HariniMalothu17

Copy link
Copy Markdown
Author

Superseded by #11656, which contains the identical commit (c9f6b76) raised from a branch on microsoft/microsoft-ui-xaml so PR validation runs (fork PRs don't trigger the pipeline). Closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-triage Issue needs to be triaged by the area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Voice Access] TextBox & NumberBox (Inline mode) x button cannot be targetted

2 participants