Skip to content

[html-aam] Set heading level based on HTML computed heading level - #2598

Closed
keithamus wants to merge 3 commits into
w3c:mainfrom
keithamus:headingoffset
Closed

[html-aam] Set heading level based on HTML computed heading level#2598
keithamus wants to merge 3 commits into
w3c:mainfrom
keithamus:headingoffset

Conversation

@keithamus

@keithamus keithamus commented Aug 14, 2025

Copy link
Copy Markdown
Member

Refs whatwg/html#11086.

This wires up HTML-AAM to the headingoffset feature of the html spec which defines an algorithm for computing a heading level.

Test, Documentation and Implementation tracking

Once this PR has been reviewed and has consensus from the working group, tests should be written and issues should be opened on browsers. Add N/A and check when not applicable.

@netlify

netlify Bot commented Aug 14, 2025

Copy link
Copy Markdown

Deploy Preview for wai-aria ready!

Name Link
🔨 Latest commit d8cbe85
🔍 Latest deploy log https://app.netlify.com/projects/wai-aria/deploys/697113dc65608300085a436d
😎 Deploy Preview https://deploy-preview-2598--wai-aria.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@rahimabdi

Copy link
Copy Markdown
Contributor

Should the WebKit bug link to: https://bugs.webkit.org/show_bug.cgi?id=295092?

@scottaohara scottaohara left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can't make the meeting today, so wanted to get in a quick review. thank you again for working on this.

Comment thread html-aam/index.html
<td>
<a class="core-mapping" href="#role-map-heading">`heading`</a> role, with the <a class="core-mapping" href="#ariaLevel">`aria-level`</a> property set to the number in the element's tag
name.
<a class="core-mapping" href="#role-map-heading">`heading`</a> role, with the <a class="core-mapping" href="#ariaLevel">`aria-level`</a> property set to the <a data-cite="html/sections.html#get-an-element's-computed-heading-offset">the computed heading level</a>.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

initial reaction to this is "awesome! this is moving forward!"

But, in regards to how these new features should be specified in this spec, it might be best to combine the proposed updated text with the original text. e.g., indicate that the default level of a heading element would correlate to the number used in the tag name. But, the computed heading level of the element can be adjusted if also used with the new headingoffset and headingreset attributes.

Then those attributes would need to be added to the attributes table (so then their mention in the heading element mapping table can then in-doc link to those attributes) indicating how they can adjust the heading level (aria-level) mapping for in-scope heading elements.

Probably also worth adding a note stating that specifying an aria-level attribute will take priority over whatever the implicit aria-level would be exposed as.

@keithamus
keithamus marked this pull request as draft August 14, 2025 17:06
@jnurthen
jnurthen requested a review from Copilot August 14, 2025 22:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the HTML-AAM specification to use the HTML computed heading level algorithm instead of simply using the number in the heading element's tag name for setting the aria-level property. This change aligns with recent HTML specification updates that introduce a headingoffset feature for computing heading levels.

Key changes:

  • Updates the mapping for h1-h6 elements to reference the HTML spec's computed heading level algorithm
  • Replaces direct tag name number usage with a more sophisticated heading level calculation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread html-aam/index.html
<td>
<a class="core-mapping" href="#role-map-heading">`heading`</a> role, with the <a class="core-mapping" href="#ariaLevel">`aria-level`</a> property set to the number in the element's tag
name.
<a class="core-mapping" href="#role-map-heading">`heading`</a> role, with the <a class="core-mapping" href="#ariaLevel">`aria-level`</a> property set to the <a data-cite="html/sections.html#get-an-element's-computed-heading-offset">the computed heading level</a>.

Copilot AI Aug 14, 2025

Copy link

Choose a reason for hiding this comment

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

There is an extra "the" in the phrase "set to the the computed heading level". It should be "set to the computed heading level".

Suggested change
<a class="core-mapping" href="#role-map-heading">`heading`</a> role, with the <a class="core-mapping" href="#ariaLevel">`aria-level`</a> property set to the <a data-cite="html/sections.html#get-an-element's-computed-heading-offset">the computed heading level</a>.
<a class="core-mapping" href="#role-map-heading">`heading`</a> role, with the <a class="core-mapping" href="#ariaLevel">`aria-level`</a> property set to <a data-cite="html/sections.html#get-an-element's-computed-heading-offset">the computed heading level</a>.

Copilot uses AI. Check for mistakes.
@pkra

pkra commented Dec 4, 2025

Copy link
Copy Markdown
Member

The upstream PR has landed. Should this move out of draft, @keithamus ?

@keithamus
keithamus marked this pull request as ready for review January 22, 2026 10:22
@keithamus

Copy link
Copy Markdown
Member Author

Closing this in favour of #2720 which is both updated but also pushed to the right remote, so that we get deploy previews.

@keithamus keithamus closed this Jan 22, 2026
@github-project-automation github-project-automation Bot moved this from Draft to Waiting For Implementation in ARIA Normative PR Tracking Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants