Skip to content

Expose AutoSuggestBox AccessKey through editable TextBox - #11729

Open
Rashmi Thakur (rashmi-thakurr) wants to merge 3 commits into
mainfrom
user/rashmithakur/autosuggestbox-accesskey-peer-fallback
Open

Expose AutoSuggestBox AccessKey through editable TextBox#11729
Rashmi Thakur (rashmi-thakurr) wants to merge 3 commits into
mainfrom
user/rashmithakur/autosuggestbox-accesskey-peer-fallback

Conversation

@rashmi-thakurr

@rashmi-thakurr Rashmi Thakur (rashmi-thakurr) commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Fixes

Fixes #7777

PR Type

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Description

Current Behavior

AutoSuggestBox exposes editing through an internal TextBox. When an AccessKey is set on the AutoSuggestBox, the focused TextBox automation element does not report it, so Narrator and other UI Automation clients cannot discover the shortcut.

New Behavior

AutoSuggestBox now supplies its formatted AccessKey to its editable TextBox only when the child has no AccessKey value of its own. The implementation is contained entirely in AutoSuggestBox; it does not modify the shared TextBoxAutomationPeer.

AutoSuggestBox tracks whether it owns the supplied value. Parent updates propagate only while that ownership remains valid, and clearing or retemplating removes only the value AutoSuggestBox supplied. A child AccessKey set later, including an explicitly empty value, immediately takes precedence. Clearing that child value allows propagation to resume.

AutomationId is not propagated, and the UIA tree is unchanged.

Customer Impact

Narrator, Accessibility Insights, and other UI Automation clients can discover the AutoSuggestBox AccessKey from the focused editable TextBox. Custom template values, explicit child values, standalone TextBox behavior, AutomationIds, and UIA hierarchy remain unchanged.

Regression Potential

The behavioral change is isolated to AutoSuggestBox and its verified editable TextBox template part. It does not alter shared TextBox automation behavior or other controls.

  • Low risk — isolated change, limited scope
  • Medium risk — touches shared components or public APIs
  • High risk — architectural or breaking API change

How Has This Been Tested?

  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • Existing tests pass locally

Screenshots (if appropriate)

Not applicable; this change has no visual impact.

Derive the AutoSuggestBox AccessKey dynamically from its verified editable TextBox automation peer while preserving explicit child values and avoiding dependency-property mutation. Add UIA and precedence coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 97ad465d-30ee-4a40-b0cd-54285d48a009
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the needs-triage Issue needs to be triaged by the area owners label Aug 31, 2026
@rashmi-thakurr
Rashmi Thakur (rashmi-thakurr) marked this pull request as draft August 31, 2026 13:59
Rashmi Thakur added 2 commits August 31, 2026 20:07
Move the editable TextBox AccessKey behavior out of the shared automation peer. Preserve explicit child values, track AutoSuggestBox ownership, and clear only values supplied by AutoSuggestBox.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 21452886-d731-4386-bf87-f4461c8bd264
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 21452886-d731-4386-bf87-f4461c8bd264
@rashmi-thakurr
Rashmi Thakur (rashmi-thakurr) marked this pull request as ready for review August 31, 2026 15:09
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown

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 fixes an accessibility/automation gap in AutoSuggestBox by ensuring UI Automation clients can discover an AutoSuggestBox’s AccessKey from the focused editable TextBox element (the primary automation target for editing).

Changes:

  • Adds AutoSuggestBox logic to propagate a formatted AccessKey to the internal editable TextBox via AutomationProperties.AccessKey, but only when the TextBox has no AccessKey (or automation access key) set on itself.
  • Tracks ownership of the propagated value so it can update/clear only what AutoSuggestBox supplied, including correct behavior across template reapplication.
  • Adds/updates native external automation integration tests to cover propagation, precedence (child AccessKey and AutomationProperties.AccessKey), resumption after clears, and ensuring AutomationId is not propagated.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
dxaml/xcp/dxaml/lib/AutoSuggestBox_Partial.h Declares new helpers/state for propagating and tracking the propagated AccessKey on the editable TextBox.
dxaml/xcp/dxaml/lib/AutoSuggestBox_Partial.cpp Implements propagation/ownership logic, wires a property-changed callback on the child TextBox.AccessKey, and updates propagation on relevant parent property changes and templating.
dxaml/test/native/external/controls/autosuggestbox/AutoSuggestBoxAutomationPeerIntegrationTests.h Adds a new test method and extends helper setup to optionally apply an AccessKey.
dxaml/test/native/external/controls/autosuggestbox/AutoSuggestBoxAutomationPeerIntegrationTests.cpp Extends automation-property verification and adds a precedence-focused test covering parent updates, child precedence (including explicit empty), and resumption.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@rashmi-thakurr

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

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

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.

AutoSuggestBox's AccessKey not visible from automation tools

2 participants