Skip to content

ARIA heading role: aria-level is required #39482

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

js-choi
Copy link
Contributor

@js-choi js-choi commented May 12, 2025

Description

Changes the description of the ARIA heading role’s aria-level attribute to state that it is required, rather than stating that it defaults to 2.

Motivation

See the ARIA 1.3 specification for heading:

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.

Additional details

The MDN page on the aria-level role already states that the heading role is required.

I’m not sure where the “If no level is present, a value of 2 is the default” claim comes from.

Related issues and pull requests

None.

See the [ARIA 1.3 specification for heading](https://www.w3.org/TR/wai-aria-1.3/#heading):

> 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.
@js-choi js-choi requested a review from a team as a code owner May 12, 2025 01:26
@js-choi js-choi requested review from scottaohara and removed request for a team May 12, 2025 01:26
@github-actions github-actions bot added Content:Accessibility Accessibility docs size/xs [PR only] 0-5 LoC changed labels May 12, 2025
Copy link
Contributor

@scottaohara
Copy link
Contributor

scottaohara commented May 12, 2025

I’m not sure where the “If no level is present, a value of 2 is the default” claim comes from.

defaulting to a level of 2 is how the role was previously spec'd, and it is what browsers are instructed to do to mitigate author error for not requiring a level.

see in section 9.2 States and Properties, the Fallback values for missing required attributes table. it's listed there that level 2 is the fallback value for an undefined aria-level on an element with a role of heading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Accessibility Accessibility docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants