RE: revisiting heading advice

> From: Leif Halvard Silli [mailto:xn--mlform-iua@målform.no]
> Sent: Monday, January 13, 2014 11:30 AM
> 
> Hi Adrian,
> 
> «Feel» is often synonymous with «think». Anyway, HTML5 says that if we
> don’t use <section>, then each use of an h1-h6 element implies a section.

I disagree. I understand what you are saying, but a <section> clearly groups child content while a <h#> does not and requires another <h#> to indicate when that "section" ends. I read a <h#> as implicitly sectioning while a <section> explicitly sections content.

To the spec, if you want a section of content then wrap it in a <section> instead of relying on headings. [1]

> Per the spec, I could thus have done this - which (one could claim) is also
> mentally what I did:
> 
> <section class=Level-2 ><h2>Chapter</h2>
>    <section class=Level-3 ><!--skipping <h3> suheading element-->
>       <section class=Level-4 >
>          <h4>Task</h4>
>          …
>       </section>
>    </section>
> </section>

You may have done that mentally, but your code example doesn't match what was in your head. Again, not per the spec. Per the browser, I can't say.

The argument that started this thread is that the spec isn't reflecting what browsers do and that older best practices (honoring the nesting levels regardless of use of sectioning elements) is still the best approach. Your examples are arguing for variations on that old method. Frankly, I thought that was put to bed a long time ago and that the arguments you are providing were considered not best practices. I could be wrong, but I don't see many people arguing for skipping levels anymore.

> If Web browsers *did* implement the HTML5 outline, then authors would be
> encouraged to follow the (yes) rigor that the HTML5 outline algorithm
> promotes. (And, btw, rigor can be a good thing.)

Which browsers don't, and so this is moot. Though there is rigor in the older (current) method that should still be followed.

> But alternatively, one could modify the HTML outline algorithm so that if you
> jump from <h2> to <h4>, without a <h3> in between, a wrapper consisting of
> a heading-less level 3 section is implied around the
> (implied) level 4 section - like in my code example above.

Yes, modifying the outline algorithm can be done as you suggest, but if the browsers aren't honoring the one that's specced in HTML5, then isn't this just academic?

If you want to hack through the feasibility of extending the outline algorithm, my guts tells me that what you suggest is a little too complex for the browsers to implement consistently. I also wonder how this would impact the shadow DOM and what authors might expect from this implied/inserted <section>s. I also wonder if the browser should be allowed to choose a <section> when the page may be a sea of <article>s, thereby creating structure that the author might not want.

> Frankly, I would prefer this variant, because outline level *is* semantic. And I
> don’t want <h4> to be moved upwards (or inwards) in the outline,  just
> because I ”forgot” to add the <h3> heading. Such a thing could be confusing
> not only to AT users but to every user.

I think forgetting the <h3> is more confusing. Putting the onus on the browsers via a complex spec addition seems counter-intuitive to me when a simple code edit after validation for these missing heading levels would clear up the issue.

> Such a varian of the outline algorithm could be more compatible with the
> actual content «in the wild», including compatible with how legacy tools
> present outlines.

What legacy tools? Browsers today? I don't consider those legacy since they are the current tools.

I understand "paving the cowpaths," but I think this one is a bit too windy of a path and allowing the occasional pothole might be the most appropriate solution.

> In a summary, I think use of <section> should trump use of headings, with
> regard to the level (thus, one can produce level 7, if one uses seven levels of
> <section>).  But when section is not used, then a ”level jump” from - for
> instance - h1 to h4, should mean that (in this
> case) 4 levels of sections are implied, where two of them will be without
> heading.

I think you know I disagree. Use of <section> is already not supported. The "level jump" you suggest is, as far as I know, how it works today (shows h2, h3 as blank, h4 still lives at h4).


> Leif Halvard Silli
> 
> Adrian Roselli, Mon, 13 Jan 2014 15:46:57 +0000:
> >> From: Leif Halvard Silli [mailto:xn--mlform-iua@målform.no]
> >> Sent: Sunday, January 12, 2014 6:12 PM
> >>
> >> Jukka K. Korpela, Thu, 09 Jan 2014 23:21:06 +0200:
> >>> 2014-01-09 17:58, Leif Halvard Silli wrote:
> >>>> Jukka K. Korpela, Thu, 09 Jan 2014 17:04:29 +0200:
> >>
> >>> It might make sense practically to treat
> >>>
> >>> <h1>...</h1>
> >>> <h2>...</h2>
> >>> <h4>...</h4>
> >>>
> >>> so that the rank 4 heading is really at level 3, on the assumption
> >>> that such markup has been used for rendering reasons
> >>
> >> I work on the formatting of a text book with this structure:
> >>
> >> Chapter (H1)
> >>  [text]
> >>   Subheading (H2)
> >>    [text]
> >>     Task heading (H3)
> >>      [text]
> >>
> >> But quite often, the a chapter might have no subheadings, while it
> >> still still contains tasks and task headings. In that case, I don’t
> >> want the task headings to move up to level 2, so I still use h3. I
> >> also don’t want any change in the table of contents, where I use
> >> different styles for the different levels.
> >>
> >> I don't feel that I select h3 for styling reasons though - it has to
> >> do with semantics …
> >
> > Except you just said you use different styles for different levels and
> > don't want that disruption in the table of contents. Which tells me
> > you are making that decision based on the style, not the semantics.
> > Unless you can clarify how you feel it's truly a semantic decision to
> > skip that level.
> >
> > To me, the issue you describe shouldn't be reflected in your HTML, but
> > in your CSS.
> >
> > I think the task headings are at whatever level the natural flow drops
> > them (except <h7> and higher, since that doesn't exist). IMO, it's
> > appropriate that the <h4> should be structurally moved up to an <h3>
> > when parsed. Since the browsers aren't doing that anyways (as far as I
> > know), then it should be coded as an <h3> anyway.


[1] http://www.w3.org/html/wg/drafts/html/master/sections.html#headings-and-sections

Received on Monday, 13 January 2014 17:11:06 UTC