W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2004

[whatwg] Re: <section> and headings

From: James Graham <jg307@cam.ac.uk>
Date: Thu, 2 Sep 2004 10:42:50 +0100
Message-ID: <74881C69-FCC4-11D8-9CFF-000A95A16EDA@cam.ac.uk>

On 2 Sep 2004, at 03:32, Lachlan Hunt wrote:

> James Graham wrote:
>> On 31 Aug 2004, at 16:14, Lachlan Hunt wrote:
>>> In order to preserve the semantics of hn elements, I would produce 
>>> this outline:
>>>
>>> 1. Level 1 Heading
>>>    2. Level 2 Heading
>>>    2. Level 2/3? Heading
>>>
>>> Although it may not necessarily be structurally correct for that 
>>> document structure, the semantics of hn elements are preserved.
>> Ack. So presumably:
>> <section>
>>     <h>Level 1 Heading</h>
>>     <section>
>>         <h>Level 2 Heading</h>
>>         <section>
>>             <h4>Level 2/4? Heading</h4>
>>         </section>
>>     </section>
>> </section>
>> Would have a level 4 heading with no level 3 heading? Yuck. Sure 
>> that's bad markup but authors use it surprisingly often.
>
> So, what outline would this produce?
> <body>
>     <h1>Heading 1</h1>
>     <h2>Heading 2</h2>
>     <h4>Heading 4</h4>
> </body>
>
> IMO, the two are semantically equivalent, and should produce identical 
> outlines.

None of those headings are children of <section> elements so the most 
backward compatible approach would be to treat them as HTML4 headings.

>   They should both produce this outline that the validator produces:
>
> *  Heading 1
>       o Heading 2
>             + A level 3 heading is missing!
>                   # Heading 4

The "A level $level heading is missing" approach is terrible UI (for a 
client application rather than for the validator) because the user 
doesn't care that the markup is imperfect and has no way to fix the 
problem anyway. So even with pure HTML4 I would expect any client app 
to produce an outline like:

Heading 1
|--Heading 2
    |--Heading 4

As I've mentioned, I don't really think the HTML 4 heading model is 
robust enough to create structure. Hence my desire to tweak it.

>
>>> <body>
>>>     <h>Heading 1</h>
>>>     <section>
>>>         <h>Heading 2a</h>
>>>         <h2>Heading 2b</h2>
>>>         <section>
>>>             <h2>Heading 2c</h2>
>>>         </section>
>>>     </section>
>>>     <h2>Heading 2d</h2>
>>> </body>
>>> ...
>>> Heading 1
>>>     Heading 2a
>>>     Heading 2b
>>>     Heading 2c
>>>     Heading 2d
>> I disagree that this should be the interpretation of the markup 
>> above. Heading 2c should be a level lower than 2b

Sorry, I forgot to mention that Heading 2d should be at the same level 
as Heading 1 (since it's in the same section).

>
> Ok, let's look at that a bit closer.  If I understand you correctly, 
> then each section should start with an h1, and subsequent headings 
> should be regarded as various levels of sub heading.  Thus, there are 
> several missing headings:
>
> * Heading 1
>     o Heading 2a
>     o A Level 2, Heading 1 is Missing! **
>     -o Heading 2b
>         + A Level 3, Heading 1 is Missing!
>         -+ Heading 2c
> * A Level 1, Heading 1 is Missing! **
> -* Heading 2d

Assuming that we're not regarding headings in the same section as 
subtitles for the section rather than titles, the structure from the 
above, in my model, would be:

Heading 1
|--Heading 2a
|--Heading 2b
    |--Heading 2c
Heading 2d

My model ignores whether one uses <h1>, <h2>... or even a hypothetical 
<h> for the purposes of structure (justification: authors already do 
the same so we're unlikely to break any UAs that work with real 
websites). The choice of <h1>....<h6> should reflect the 'importance' 
of the heading. In a highly structured document, this might reflect the 
structure. In a newspaper, this might reflect the editorial importance 
attached to each story. In a document with a sidebar, the sidebar 
headings might be given lower importance than the headings in the main 
content.

>
> ** Note: Missing Headings marked with ** could possibly be assumed to 
> be the headings just maked up with <h>, but I don't really like mixing 
> numbered headings with unnumbered headings, since an <h> could only 
> ever fill in for an <h1> in that case.
>
>> (I also think that only the first heading in a section should be 
>> regarded as a section title, the rest as subtitles. But I'm more 
>> ready to be persuaded that that's a bad idea)
>
> No, that is a bad idea.  Same-level structured headings should not be 
> regarded as sub headings for the purpose of an outline.  (Numbered 
> headings should work as I have already described.)
> eg.
> <section>
>     <h>Heading A</h>
>     <p>content...</p>
>     <h>Heading B</h> <!-- This is not a sub heading -->
>     <p>content...</p>
> </section>
>
> unless you want to force authors to have to do the following which, 
> from my experience of using divs for the same purpose, can result in 
> an unmanageable structure when there are lots of headings.
>
> <section>
>     <h>Heading A</h>
>     <p>content...</p>
> </section>
> <section>
>     <h>Heading B</h>
>     <p>content...</p>
> </section>
>

Yeah, that worried me too. I was also concerned about the speed impact 
of the additional CSS rules that would be required in the UA 
stylesheet. However authors already use heading elements as subtitles. 
So having a standardised mechanism to do this would be nice.
Received on Thursday, 2 September 2004 02:42:50 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:37 UTC