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

aria-label should not be required when role="heading" #1002

Closed
lifeiscontent opened this issue Aug 7, 2024 · 3 comments
Closed

aria-label should not be required when role="heading" #1002

lifeiscontent opened this issue Aug 7, 2024 · 3 comments
Assignees

Comments

@lifeiscontent
Copy link

as described here: https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA12#example-1-simple-headings

@ljharb ljharb changed the title aria-lavel should not be required when role="heading" aria-label should not be required when role="heading" Aug 9, 2024
@lb-
Copy link
Contributor

lb- commented Oct 23, 2024

I have confirmed that aria-label is not required when using role="heading". See https://www.w3.org/TR/wai-aria/#heading

heading role
A heading for a section of the page.

To ensure elements with a role of heading are organized into a logical outline, authors MUST use the aria-level attribute to indicate the proper nesting level.

However, I am unable to reproduce the linting issue as described. This code below correctly produces no warning.

/* eslint
  "jsx-a11y/role-has-required-aria-props": "warn",
*/

const Heading = () => (
  <div role="heading" aria-level={3}>
    Vite + React
  </div>
);

export default Heading;

Nonetheless I will prepare a PR that includes validity testing for this scenario.

lb- added a commit to lb-/eslint-plugin-jsx-a11y that referenced this issue Oct 23, 2024
Add unit tests to ensure that there are no warnings when role="heading" is used when aria-level is provided. For example, aria-label is not required.
See jsx-eslint#1002
ljharb pushed a commit to lb-/eslint-plugin-jsx-a11y that referenced this issue Oct 25, 2024
Add unit tests to ensure that there are no warnings when role="heading" is used when aria-level is provided. For example, aria-label is not required.
See jsx-eslint#1002
@lb-
Copy link
Contributor

lb- commented Oct 25, 2024

We can probably close this issue now. PR with reinforcement tests have been added.

@ljharb
Copy link
Member

ljharb commented Oct 26, 2024

Closed by #1022.

@ljharb ljharb closed this as completed Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants