W3C home > Mailing lists > Public > public-html@w3.org > May 2014

RE: should HTML have a <heading> element?

From: Adrian Roselli <Roselli@algonquinstudios.com>
Date: Sat, 10 May 2014 22:58:27 +0000
To: Steve Faulkner <faulkner.steve@gmail.com>, HTMLWG WG <public-html@w3.org>
CC: Marco Zehe <marco.zehe@googlemail.com>
Message-ID: <0CB063710346B446A5B5DC305BF8EA3E2E18E7B2@Ex2010MBX.development.algonquinstudios.com>

Not sure I understand how a "hybrid" document might work from the description below.

If I have mixed <h#>s and <heading>s, sometimes within a sectioning element, the browser will have to make some nesting assumptions I may not want -- assuming a <heading> is what triggers a browser to drop into an outline mode.

<main>
<h1>Title</h1>
<p>content</p>
<h2>Subtitle</h2>
<p>content</p>
	<section>
	<heading>Section Title</heading>
	<p>content</p>
	<heading>Section Subtitle</heading>
	<p>content</p>
	</section>
	<section>
	<heading>Other Section Title</heading>
	<p>content</p>
	<h2> Other Section Subtitle</h2>
	<p>content</p>
	<h3> Other Section Sub-Subtitle</h3>
	<p>content</p>
	<h2> Other Section Subtitle</h2>
	<p>content</p>
	</section>
</main>

I see that as:

Title
	Subtitle
		Section Title
		Section Subtitle
		Other Section Title
			Other Section Subtitle
				Other Section Sub-Subtitle
			Other Section Subtitle

I see all <heading>s as a peer to all other <heading>s within a given section. You can't know how to "nest" them otherwise (<h#> has that capacity built in).

In my own writing I often drill down to an <h3>, through to an <h4>, back up to the <h2>, and down again [1]. Unless we start manually adding attributes with nesting level, I couldn't rely on <heading> alone to convey my document/content structure (maybe that's the point?).

However, when you start throwing <h#> within a section (which includes <section>) that is opened with <heading>, perhaps the nesting order resets, treating <heading> as the next highest available nesting level for the page, and subsequent <h#>s maintain their relative nesting order starting below the <heading>. So <heading> resets subsequent <h#> to start below, regardless of a <h#> number.

IOW, that's what my pseudo-code-tree above does.

Conversely, if we simply discard all <h#> for document outlines and lean solely on <heading> then I suppose that removes my concern. I can still use <h#> in my content comfortably, provided they aren't factored into the outline. The drawback, IMO, is that <heading> can really only exist once in a section without implying peer-level content that may not be so. It also removes the value for users from a well-structured (via <h#>) document.


[1] http://blog.adrianroselli.com/2013/09/new-ipad-browser-coast-by-opera.html



> From: Steve Faulkner [mailto:faulkner.steve@gmail.com] 
> Sent: Friday, May 09, 2014 4:32 AM
> 
> discussion starter:
> HTML5 has the outline algorithm [1] (as yet largely unimplemented  )
> which effectively removes the semantic meaning of numeric headings. 
>  
> example: 
> <body>
> <h6>
> 
> does not mean a heading level 6 it means a heading level 1 
>  
> 
> conversely:
> <body>
> <section />
> <section />
> <section />
> <section />
> <section />
> <section />
> <h1>
> 
> does not mean a heading level 1 it means a heading level 7 It has been
> suggested by marco zehe from Mozilla [3] that the only clean way
> forward for the outline algorithm is this:
> 
> 1. Leave h1 to h6 alone as they always were. h1 through h6 are always
> that regardless of what they are nested in.
> 
> 2. Introduce a new element named "heading" or the like that is the only
> element participating in the outline algorithm. it gets a level of 1 by
> default, and a level of greater than 1 depending on which section
> elements it is nested in. So a section heading gets a level of 2, a
> section section heading gets a level of 3 etc. And the calculation of
> the levels is the sole responsibility of the browser, indicating the
> calculated level as an implicit aria-level attribute. Styling could
> then be based off the section nesting or the proposed DOM attribute
> that would correspond to implicit aria-level.
> 
> This is the only way where there is a clean choice for web developers:
> Use the limited 1 to 6 heading levels, or choose a more free and modern
> way of structuring documents, and the browser takes care of
> communicating the level to assistive technologies.
> 
> 
> A custom <heading> element [2] designed to explore how such a feature
> could work in practice is in development.
> 
> [1] http://www.w3.org/html/wg/drafts/html/master/sections.html#outlines

> [2] https://github.com/ThePacielloGroup/w3c-heading#w3c-heading

> [3] https://www.w3.org/Bugs/Public/show_bug.cgi?id=25003#c18



Received on Saturday, 10 May 2014 22:58:58 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:16:39 UTC