-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Element request: <h>
to reconcile heading levels, outlines, and components
#7390
Comments
Possible duplicate of #5033 Current spec has proved a damn nuisance when making components WCAG compliant. Please note that there are no UAs that fully support the HTML5 Document Outliner Algorithm - it is not communicated to the accessibility tree either. I think the effort has lost steam, but not necessarily for the best reasons. WCAG does not require heading levels to follow absolutely consecutively, but if the level suddenly jumps "backwards" (e.g. a H2 inside something that has a H3 at the top) it is flagged as a WCAG compliance failure by most reputable auditors. This puts a burden on components to inspect the context, to discover the current heading level to start from, which is a fragile sort of practice. Components are supposed to be self-contained. I really don't think a level-less It would be better if we could express headings relative to that of the nearest ancestor heading, e.g. So the following snippets would be semantically identical:
Side note: Aria distinguishes the heading semantic from the heading level semantic, but has no relative level mechanism, although it is under discussion. |
Other related discussions/proposals:
|
No vote or preference, just—markup history: |
Thank you for the prior, related links. Although I would typically close the issue, to reiterate w3c/html#774 (comment) I'll leave it open and another can close it when they wish.
|
I'm very annoyed that <h> tag hasn't been added to the spec yet. As a web developer, I have been suffering from the lack of this tag for many years, in the absence of which I have to use <h1>-<h6> tags, which creates a lot of problems when splitting an internal application structure into modules. Like many other web developers, I look forward to when this tag will appear in the specification. Please consider adding <h> tag to the specification. |
I know +1 comments are generally not good so I will try to make this something more than that. Rough HTML <body>
<header><h>This would be a h1</h></header>
<section>
<h>This would be a h2</h>
<section>
<h>This would be a h3</h>
</section>
</section>
</body> Having a level attribute to override the automatic behaviour for when thats needed would make sense. Then CSS styling can be something like "h[level=1]" ideally this would match all of (but certainly the first two)
This would be particularly helpful given how many web pages are authored in a way that uses reusable components that don't necessarily know their context. In the same way container queries allow the author to worry less about the context of the markups usage. A element would also allow us to do the right thing for any usage of the component. |
We should just make |
Related: #5033 (comment) |
The problem with using specific heading levels ("
<h4>
") is it couples components to their containing context.On the other hand, using
<h1>
everywhere and relying upon the outline algorithm makes an incorrect and contradictory assertion; every heading is of '1' level.<h>
's level would be dynamic to the outline as composed.The text was updated successfully, but these errors were encountered: