Comments on: Computer says NO to HTML5 document outline https://stevefaulkner.github.io/html5doctored/computer-says-no-to-html5-document-outline/ helping you implement HTML5 today Thu, 28 Jul 2016 17:36:34 +0000 hourly 1 By: Mark Simon https://stevefaulkner.github.io/html5doctored/computer-says-no-to-html5-document-outline/#comment-2130593 Wed, 29 Jun 2016 01:58:29 +0000 http://html5doctor.com/?p=6030#comment-2130593 OK, I’ve put a lot of thought into this, and I think that the original concept can be rescued.

To my mind, there are two approaches to implementing a document outline:

The approach taken by word processors is have a linear document, but to imply the outline from the heading levels. This is also the approach taken in HTML using the h1 … h6 elements, though HTML has not traditionally done anything else with.

A more structure approach is to explicitly construct the outline using nested structures. This is the approach that HTML5 seeks to introduce.

The problem arises when both are being used. In principal, you could imply an outline using the heading levels, or create one using nested sections and only h1 headings (creating virtually level-less headings). However, if you start nesting heading levels as well, there is a conflict in interpretation.

One approach is to disallow heading levels, but, at this point, I think that is an unnatural approach — many people create their document linearly rather than from an outline.

I think a better approach is to require that all nested sections begin their heading levels from h1 and work downwards. To get to the next level, you either have a lower level heading, or nest a new section element and start again.

A simple outlining algorithm could be calculated as follows:

level = heading level + nesting depth

This would imply that h2 in the body is at the same level as h1 in a nested section, and I think that is intuitive.

What about starting nested sections with a lower level? Browsers have always forgiven sloppy coding, and I think that this should be an example of such. I don’t think they should be expected to re-number level headings.

I know this is not currently advised, but I think it would be easy to understand and implement.

]]>
By: Steve Faulkner https://stevefaulkner.github.io/html5doctored/computer-says-no-to-html5-document-outline/#comment-2129805 Thu, 23 Jun 2016 13:06:36 +0000 http://html5doctor.com/?p=6030#comment-2129805

I may have misunderstood the intent of outlining.

Yes you have, like many other people.

A simple illustration of how the outline algorthm works is by running the demo page I provided through the W3C HTML checker- this provides 2 outline views. If you look at the second outline view (the HTML5 outline algorithm implementation) you will see that the 2 headings are on the same level.

]]>
By: Alohci https://stevefaulkner.github.io/html5doctored/computer-says-no-to-html5-document-outline/#comment-2129692 Thu, 23 Jun 2016 00:50:18 +0000 http://html5doctor.com/?p=6030#comment-2129692 “there is no suggestion that a nested h6 would be ranked higher in the absence of higher level headings.”

And yet that is what the outline algorithm, rightly or wrongly, requires. Which is why the half-arsed styling applied by the user-agent style sheet for h1 elements inside article elements is so misleading and ultimately unhelpful.

]]>
By: Mark Simon https://stevefaulkner.github.io/html5doctored/computer-says-no-to-html5-document-outline/#comment-2129664 Wed, 22 Jun 2016 21:48:25 +0000 http://html5doctor.com/?p=6030#comment-2129664 I may have misunderstood the intent of outlining.

I thought that while a nested h1 would be ranked lower, there is no suggestion that a nested h6 would be ranked higher in the absence of higher level headings. The observed behaviour of the major browsers (Firefox, Chrome and Safara – I haven’t tested this on IE or Edge) would be as expected.

The same would apply even without using sectioning elements. Beginning your page with an h4 and going down from there was tolerated but never recommended. You should always start with h1 and work downwards from there.

The notion of the HTML5 outlined applied the same logic to so-called section elements, and you would be expected to start with h1 again. Starting lower would be creating orphans.

I do think, however, exposing the outline, say as a JavaScript object, would have been helpful.

]]>
By: Steve Faulkner https://stevefaulkner.github.io/html5doctored/computer-says-no-to-html5-document-outline/#comment-2129596 Wed, 22 Jun 2016 08:25:58 +0000 http://html5doctor.com/?p=6030#comment-2129596

This a seriously missed opportunity.

I think we all pretty much agree that in theory the outline algorithm is a good thing. But it has been damaging in practice as it has been evangelized before its time (if there ever will be a time).

However, I thought that some browsers were outline-aware. Firefox, for example, will show article>h1 elements in a smaller font, indicating that it knows about the outline.

Some browsers implement CSS rendering of nested h1‘s as per the algorithm, but thats it. It’s brittle. In this demo the outline algorithm dictates that the 2 headings (h1 and h6) in the article elements both have a rank of 2 (as they are nested 1 deep) and therefore should be displayed with the same size to reflect this. But they aren’t… Furthermore size does not convey the semantics robustly at all.

The point is, is it no longer correct to begin an article (or aside etc) with an h1 element?

A heading in an body>h1>article element has a rank of 2 so should be a h2. The only caveat to this is when you have one or more article elements on a page that has no h1 scoped to body body>article

]]>
By: Mark Simon https://stevefaulkner.github.io/html5doctored/computer-says-no-to-html5-document-outline/#comment-2129287 Mon, 20 Jun 2016 02:43:48 +0000 http://html5doctor.com/?p=6030#comment-2129287 This a seriously missed opportunity.

The whole point of the outlining concept, as far as I can discern, is to allow, for example, an article element to nestle inside a section element without having to re-number the heading level.

I think the real problem is that consensus my not have been as clear as it seemed from the outside. After all, it’s not as if the browser manufacturers were left out of the picture. Many of actual the specifications are a bit fuzzy, and appear the be the result of compromise rather that consensus.

However, I thought that some browsers were outline-aware. Firefox, for example, will show article>h1 elements in a smaller font, indicating that it knows about the outline.

The point is, is it no longer correct to begin an article (or aside etc) with an h1 element?

]]>
By: Steve Faulkner https://stevefaulkner.github.io/html5doctored/computer-says-no-to-html5-document-outline/#comment-2129006 Fri, 17 Jun 2016 18:04:56 +0000 http://html5doctor.com/?p=6030#comment-2129006 Well Steve, what we do know is that anything nested in a sectioning element is going to represent at least a h2 as only headings scoped to body are equivalent to h1, so if you are advocating fucking users at least fuck them with a h2.

]]>
By: Steven Vachon https://stevefaulkner.github.io/html5doctored/computer-says-no-to-html5-document-outline/#comment-2128994 Fri, 17 Jun 2016 16:14:41 +0000 http://html5doctor.com/?p=6030#comment-2128994 F*** them — I’m doing it anyway. When you have reusable components with no understanding of its parent structure, outline semantics are a necessity.

]]>
By: Henrik Ståhl https://stevefaulkner.github.io/html5doctored/computer-says-no-to-html5-document-outline/#comment-2128844 Thu, 16 Jun 2016 19:47:08 +0000 http://html5doctor.com/?p=6030#comment-2128844 I’m a journalist turned product owner who’s trying to learn programming, markup and other interesting things, and for the last couple of weeks I have been devouring everything I’ve been able to come across regarding HTML5 and CSS3.

I adopted the concept of document outline and the nesting level in sectioning elements relatively quickly. The reason for that is quite simple:

It makes sense.

(Super sad Puss in Boots face)

Well oh well. Hopefully I can become a Markup Master anyway, somehow.

]]>
By: Bill https://stevefaulkner.github.io/html5doctored/computer-says-no-to-html5-document-outline/#comment-2128779 Thu, 16 Jun 2016 14:32:14 +0000 http://html5doctor.com/?p=6030#comment-2128779 Seems like an alternate implementation could be sectionheader or articleheader.

]]>