|
|
|
|
|
by notpushkin
662 days ago
|
|
> Take headings, for example: in component-based development, I often don't know (and shouldn't care) what level a heading is in my reusable widget, but I am forced to choose regardless. We could have used <h1>s everywhere with Document Outline: <body>
<h1>top level heading (parent sectioning element is body)</h1>
<section>
<h1>2nd level heading (nested within one sectioning element)</h1>
...
</section>
</body>
Unfortunately, this was never implemented in browsers and was removed in HTML 5.1.https://html5doctor.com/computer-says-no-to-html5-document-o... |
|
I agree that when developing a component, or even a discrete piece of content, you shouldn't have to care about its place in the heading hierarchy of whichever pages it appears on. But someone needs to care.
There's an HTML spec idea kicking around that's currently called `headinglevelstart`. I think the idea is you put it on an element like <section> and give it a value and the heading level of any heading element within is incremented by that amount; use `headinglevelstart="2"` and an <h1> within is treated as an h3, an <h2> as an h4, and so on (I think extending the valid heading levels from 6 to each least what ARIA supports, 9, is along for the ride). It can even be a negative value so an <h2> heading that's typically lots of other pages could be "elevated" when it's by itself on its own page by adding `headinglevelstart="-1"` to a parent.
I don't know if `headinglevelstart` is a particularly good idea or if it will happen but it's definitely an aspect of the web in need of improvement.