content icon indicating copy to clipboard operation
content copied to clipboard

ARIA heading role: aria-level is required

Open js-choi opened this issue 7 months ago • 3 comments

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.

js-choi avatar May 12 '25 01:05 js-choi

Preview URLs

External URLs (1)

URL: /en-US/docs/Web/Accessibility/ARIA/Reference/Roles/heading_role Title: ARIA: heading role

(comment last updated: 2025-06-30 07:53:31)

github-actions[bot] avatar May 12 '25 01:05 github-actions[bot]

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

scottaohara avatar May 12 '25 19:05 scottaohara

Thanks for the explanation, @scottohara. I will update the pull request with an explanation that, if the required attribute is not specified, then a fallback value of 2 will be specified.

js-choi avatar May 15 '25 22:05 js-choi