Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(access-name): get name from header elements #4097

Merged
merged 7 commits into from
Aug 8, 2023

Conversation

WilcoFiers
Copy link
Contributor

The content of landmarks and other elements that have "name from author" should not be ignored when referenced by aria-labelledby or another label.

This is a bug, where axe was inconsistent with the accessible name spec. Specifically, step F:

if the current node's role allows name from content, or if the current node is referenced by aria-labelledby, aria-describedby, or is a native host language text alternative element (e.g. label in HTML), or is a descendant of a native host language text alternative element

Previously axe-core was only considering the first part of this sentence, and skipping name from author elements while following aria-labelledby and <label> IDREFs. This was a problem on dialogs (as the issue reported), but had broader implications too. Notably, column and rowheaders in a table could not be referenced with aria-labelledby.

That created a second problem; Elements with a value (like select and progressbar) should never use name from content. I had to add a condition in for that. I ended up testing the use of element values in names again. This improved a good bit, and so now only the value of progressbar still can't be relied on to give an accessible name.

Closes: #3752

@WilcoFiers WilcoFiers requested a review from a team as a code owner July 20, 2023 11:57
></label>

<div>
<label>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This label does nothing, and fail24 is not tested by this rule; this is not the select-name rule.

test/testutils.js Show resolved Hide resolved
lib/commons/text/unsupported.js Show resolved Hide resolved
test/testutils.js Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

header in section with role should not have role banner
2 participants