Skip to content

implement headingoffset & headingreset attributes #11086

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 44 commits into
base: main
Choose a base branch
from

Conversation

keithamus
Copy link
Member

@keithamus keithamus commented Feb 28, 2025

This specifies the headingoffset and headingstart attributes as proposed in #5033.

Closes #5033

(See WHATWG Working Mode: Changes for more details.)


/dom.html ( diff )
/index.html ( diff )
/infrastructure.html ( diff )
/rendering.html ( diff )
/sections.html ( diff )

@scottaohara
Copy link
Collaborator

thank you for working on this.

aside from the comments i left in my quick review, does it make sense to explicitly call out as a note that aria-level is not considered/taken into account with these attributes?

from re-reading the issue this stems from, i'm assuming people are likely thinking that if someone declares an aria-level on a heading, the value of that attribute is what the heading level will be exposed as, yes?

Or to be very clear, do people agree with the following:

<div headingoffset=1>
  <h1 aria-level=4> level 4 </h1>
  <h1> level 2 </h1>
  <h1 headingoffset=20 headingreset aria-level=3><!-- 3 --></h1>
</div>

if HTML doesn't have a note for this, then we can get it into html aam, aria in html, or both - and i'd assume MDN author guidance.

@domenic
Copy link
Member

domenic commented Mar 1, 2025

I haven't looked at the PR text itself yet, but I think such a note/example would be valuable.

@keithamus
Copy link
Member Author

I've added a note mentioning aria-level as well as an example demonstrating their combinations.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Since this is not marked as draft and is still getting updates I'm going to make it extra clear that I consider #5033 (comment) to be blocking concerns.

@keithamus keithamus force-pushed the implement-headingoffset-headingreset-attributes branch from a83d233 to cc8c891 Compare June 27, 2025 12:57
@keithamus keithamus force-pushed the implement-headingoffset-headingreset-attributes branch from b679a63 to 56a59e2 Compare August 14, 2025 15:08
@jakearchibald
Copy link
Collaborator

Heads-up: The previews are stuck on some earlier version.

@keithamus
Copy link
Member Author

How can I kick the build previews in OP? They don't seem to be generating.

@jakearchibald
Copy link
Collaborator

They're usually automatic, so something has gone wrong.

Copy link
Collaborator

@jakearchibald jakearchibald left a comment

Choose a reason for hiding this comment

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

Btw, I think this is great, and a much-needed addition to the platform.

@@ -12042,6 +12043,9 @@ interface <dfn interface>HTMLElement</dfn> : <span>Element</span> {
undefined <span data-x="dom-hidePopover">hidePopover</span>();
boolean <span data-x="dom-togglePopover">togglePopover</span>(optional (<span>TogglePopoverOptions</span> or boolean) options = {});
[<span>CEReactions</span>] attribute DOMString? <span data-x="dom-popover">popover</span>;

[<span>CEReactions</span>, <span data-x="xattr-Reflect">Reflect</span>, <span data-x="xattr-ReflectRange">ReflectRange=(0, 9)</span>] attribute unsigned long <dfn attribute for="HTMLElement" data-x="dom-headingOffset">headingOffset</span>;
Copy link
Member

Choose a reason for hiding this comment

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

Not both Reflect and ReflectRange. The latter implies the former.

Copy link
Member Author

Choose a reason for hiding this comment

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

I cribbed from other examples such as TableColElement which has both Reflect & ReflectRange. Shall I file an issue for cleaning those up?

Copy link
Member

Choose a reason for hiding this comment

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

Oh wait. I guess you need to leave this as-is and if this lands first, then #11518 needs to remove it. (And vice versa. :-()

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Very close now I think.

@annevk
Copy link
Member

annevk commented Aug 15, 2025

@keithamus I just noticed you removed all the style sheet changes. While I don't think we have to change that example, I do think we have to change the user agent style sheet as part of this change. Do we have test coverage for the user agent style sheet being changed as part of this change?

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

I'm happy with this. I'm not happy with the variant discussed on WHATWG Chat whereby dialog in its model state can end up changing heading levels. Heading levels should stay consistent regardless of the state of controls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements
Development

Successfully merging this pull request may close these issues.

Consider adding a headingoffset attribute
7 participants