🐛 Prefer anchor and role="link" text over ancestor ARIA labels for RUM action names - #5013
Draft
anakorn-wm wants to merge 1 commit into
Draft
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
Motivation
Addresses bug report #5007
getActionNameFromElementruns everypriorityStrategiesentry against the target and up to 10 ancestors before ever falling back to text content of the target. When an anchor sits inside an ancestor with anaria-labeloraria-labelledby(for example arole="dialog"whosearia-labelledbypoints at a visually-hidden title), RUM records the ancestor's label as the action name instead of the visible anchor text the user actually clicked.This is common with accessible dialog primitives that require a title element on the dialog root, and it produces surprising click names like
click on This is a modal windowon every anchor inside the modal.Changes
The ("BUTTON, LABEL or button-like element text") priority strategy now also matches
<a>androle="link", mirroring the existing symmetry with<button>androle="button". The text content of the clicked anchor is picked at iteration 0 of the walk, so ancestor ARIA attributes no longer beat it.Behavior change to flag: an
<a>(orrole="link") that carries both a visible text label and its ownaria-labelwill now resolve to the visible text instead of thearia-label. That matches how<button>has always worked, but any team relying on the previous behavior will see a name shift. Not gated behind a config flag but happy to do so if desired.Test instructions
Checklist