fix(native): restore getByRole through Chrome's accessibility tree#1331
Open
cooleryu wants to merge 1 commit into
Open
fix(native): restore getByRole through Chrome's accessibility tree#1331cooleryu wants to merge 1 commit into
cooleryu wants to merge 1 commit into
Conversation
Contributor
|
@cooleryu is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
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 #1325.
getbyrolenow resolves roles through Chrome's accessibility tree instead of approximating ARIA roles with DOM selectors. This restores support for implicit roles such as<a href>->linkand<h1>->heading, and avoids confusing<link rel="stylesheet">with an interactive link.Root Cause
PR #1153 brought
handle_getbyroleback to a selector-based path:That only works for explicit
[role=...]or tag names that happen to match the role. It misses browser-computed roles, which is exactly whatgetByRoleis meant to use.Changes
Accessibility.getFullAXTreeforgetbyrole.exactagainst Chrome's computed AX role data.backendDOMNodeId, so a virtual AX node does not block a later actionable DOM-backed match.<link rel="stylesheet">and a clickable<a>link, plus an implicit heading role.Test Plan
cargo fmt --manifest-path cli/Cargo.toml -- --checkcargo test native::actions::tests --manifest-path cli/Cargo.tomlcargo test e2e_getbyrole_uses_accessibility_tree_for_implicit_roles --manifest-path cli/Cargo.toml -- --ignored --test-threads=1Risk
The main behavior change is that
getbyrolenow trusts Chrome's AX tree instead of a hand-rolled DOM selector. That should be closer to user-visible accessibility semantics, but it may expose different matching order where the previous selector approximation happened to find a DOM node first.