- From: Tony Middleton <tony@middleton.me.uk>
- Date: Mon, 26 May 2014 20:29:33 +0100
- To: www-validator@w3.org
Thank you for the responses. Would appear I have been reading some out-of-date documents. Regards Tony On 26/05/14 17:25, Michael[tm] Smith wrote: > "Jukka K. Korpela" <jkorpela@cs.tut.fi>, 2014-05-26 18:01 +0300: > >> 2014-05-23 19:09, Tony Middleton wrote: >> >>> I have a number of pages with a <section> which contains a number of >>> <section> groups. Both the top level section and the subsidiary >>> sections have h1 elements. This I understood is the suggested way of >>> doing things in HTML5. >> I don't think it ever was the suggested way. Rather, a possible way. >> According to current HTML5 CR, it is still permitted but strongly >> discouraged. > More details at https://www.w3.org/wiki/HTML/Usage/Headings/h1only > > A key problem in practice right now with only using H1s is that current > browsers do not yet actually expose the correct outline depth of headings > to accessibility software in the way that the HTML spec says they must. > > So if you only use H1s in a document -- even if the H1s are in nested > <section>s -- screen readers will announce all of them to users as top- > level headings regardless of what their outline depth (nesting level) is. > > That is, if your source doc has this: > > <body> > <h1>top level heading</h1> > <section><h1>(intended) 2nd level heading</h1> > <section><h1>(intended) 3nd level heading</h1> > </section> > </section> > > ...then you might expect it'd result in the headings of that document > getting presented to screen-reader users like this: > > → top level heading > → → 2nd level heading > → → → 3rd level heading > > ...but in fact it currently gets presented to SR users like this: > > → top level heading > → top level heading > → top level heading > >>> However, the validator gives me the following warning for the second >>> level h1's. >>> >>> Consider using the h1 element as a top-level heading only (all h1 >>> elements are treated as top-level headings by many screen readers and >>> other tools > That is a recent warning that was experimentally added, for the reasons > Jukka describes below. If and when browsers actually get around to > conforming to the HTML spec on this and exposing the outline depths of > heading correctly, in the way the spec requires, the warning could be > retired. (There are bugs open against all major browser engines requesting > that they implement correct outline depths for headings.) > >> This apparently reflects the change described at >> http://lists.w3.org/Archives/Public/public-html/2013Feb/thread.html#msg125 >> and the current wording at >> http://www.w3.org/TR/html5/sections.html#headings-and-sections >> which says: >> "Sections may contain headings of any rank, and authors are strongly >> encouraged to use headings of the appropriate rank for the section's >> nesting level." >> >> What this means is that you should use <h2> for any heading that is >> 2nd level relative to the page as a whole. > Yeah, so that instead of using the markup in the example above, > current best-practice (given the lack of outline-depth support in browsers > at this point) is to instead do this: > > <body> > <h1>top level heading</h1> > <section><h2>(intended) 2nd level heading</h2> > <section><h3>(intended) 3nd level heading</h3> > </section> > </section> >
Received on Monday, 26 May 2014 19:29:59 UTC