-
Notifications
You must be signed in to change notification settings - Fork 546
Do not recommend using nested sections with h1 #169
Comments
This should fix the most troubling part of #33 |
4.3.10. Headings and sections encourages authors to use sectioning content elements explicitly together with heading elements of the appropriate rank (i.e., not
|
Yes, but it then provides an outline algorithm and various examples that suggest using
Which seemed like a good idea, and has certain features that make it attractive. So my proposal is to remove everything that says using sectioning is enough to make the outline algorithm understand the nesting as a way to treat headers relative to each other, since in practice, it isn't. If you use |
The issue could probably be solved by finally introducing a levelless heading element — e. g. just
This would be free from any backward incompatibilities and would also free us from the current restriction of nesting depth of just six levels (that could be useful e. g. for HTML-based books that may contain far more levels than a regular HTML page). |
@Marat-Tanalin agreed - that would be the way to handle this. It requires browsers to implement a new element, and the outline algorithm. Until they are prepared to do something like this we're stuck with the existing |
@chaals I suspect support for the new element wouldn’t require too much. As for outline, isn’t it somewhat fictious and having no [browser] implementations at all? Update: To be clear, I clearly see how the outline algorithm could be useful for e. g. assistive technologies. The algorithm is, AFAIK, just not yet implemented in browsers. So to add support for a new local-heading element, it would probably be enough in the beginning just to provide some basic default styling. The problem with multiple |
@Marat-Tanalin a visual implementation would be insufficient. It has the same problem as the sectioning outline model we propose to remove - there is nothing reported to accessibility APIs, which for headers is actually an important use case. The outline has no native browser implementation, which is a problem. But the code isn't complex, it's just a case of whether browsers can do anything useful with it. One use case would be hierarchical navigation of a document - e.g. by putting the outline into a sidebar, or providing direct keyboard access. |
I support the idea of not recommending to use I would prefer @Marat-Tanalin’s idea of using However, I agree with @chaals that a new element should not be introduced for this unless browser vendors agree and implementation happens.
How frequent are headings with a far greater depth than six? |
While six levels may be enough for regular pages, books may potentially have much more nested subchapters. Anyway, removing depth limitation would be just a nice side effect. The main point is to get free from the legacy inherited semantics of |
Given that WCAG has a normative requirement that basically boils down to "it must work on the platforms you need to support", should we be recommending techniques that don't work on all major platforms? |
Seems like a good idea to stop recommending the pattern until (if..) it's actually implemented. I'd back the suggestion to finally add an Not saying the ranked headings shouldn't be implemented, though. There are use cases for both section+h and section+ranked headings - you can't always add wrapper elements just to set ideal heading levels.
Large legal documents can exceed six levels. There are also some cases where concatenated documents (eg. for printing) can exceed six. While not common they're definitely out there. |
Removing the last example just before 4.3.10.1 which has "This final example would need explicit style rules to be rendered well in legacy browsers." in its description looks sufficient since we have the explicit warning at the start of 4.3.10.1. about the outline algorithm. Happy to provide a PR for that if folks agree. |
If you mean removing everything from "This third example is also semantically identical, and might be easier to maintain..." down to the 4.3.10.1 heading, that WFM, but defer to @stevefaulkner @travisleithead and @arronei for an editorial +1 |
@LJWatson yes that's exactly what I meant. I'll create a PR for it. |
That editorial change looks like the right thing. |
Closing issue based on editorial change. If this needs further investigation into an element that should be taken up in WICG. |
Currently there are two recommended approaches to headings: using the
h1
-h6
in a structured nesting order, or using nested<section><h1>
blocks relying on the outline algorithm.Doing this looks right in modern browsers, which apply some simple CSS to make nested
h1
elements look similar toh2
-h6
according to the level of nesting. But the CSS used is pretty fragile, and the browsers report the level of heading e.g. through accessibility APIs ash1
whatever their nesting level.I propose that we make a counter-recommendation not to use nested
<section><h1>
while browsers do not implement it reliably.The text was updated successfully, but these errors were encountered: