Re: [VE][html5] Warning about multiple h1 seems to go against HTML5 design
"Michael[tm] Smith" <[email protected]>
| Newsgroups | gmane.org.w3c.validator |
|---|---|
| Message-ID | <[email protected]> |
"Jukka K. Korpela" <[email protected]>, 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> -- Michael[tm] Smith http://people.w3.org/mike
signature.asc
(application/pgp-signature, 836 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBCgAGBQJTg2sNAAoJEIfRdHe8OkuV2bUP/3PS1DXaQqp51QSAaoWsZsAt tIKq9c+WrjGWrrHJORjJjMvbLqVyNnSKyEO3rpW65vl0iKKQNVId8KpFzrKpg+AY /HbQPDvWYdo6mKTPTXawmoYAxnRD24xk99Oz3PGJI8XQ02giGJ4tLAwM1T0W4cgY nIreAnDmOp9baCD+lWBZiX1bneupmZvL9rEn3C2tMbu0f2Bokeok9iTXYeg8STK2 fXVI6z7U0vi/YOOzGzPMbQXEEt+M2umnZkeG/YIMj4H364zFARtK0umazSoxzJds FFRVsr2140U/ha2LtcAedNwXVuXS4OIAUFQ5IhrhCWZWc0R4mxVXxM7K1LctZedn 80qtqgUipmwbkqhtcHVQZN0OvCXwO8jw3OSaZA/4pVJWSEmX+voyl9qEwUDIWvn9 GY6hZp9GxJe9DoUz7lOJRLuzS7PYZU2Z3qDctiFXaRCUZRkh02ikygmvI1YlxKeu tU0G5mYW8mrIcZ4G8ZfTLebSgF9FSeMT+RNCeSQWWkXwnMBKCh4C2HlnZVDJrNCH EKCvhgguyXdjEhymT3yZAcLMuNehOTUycrnoXn0Yq9+KKHih9phA3Ti3SW8rxrCn CvaKoIYY/obzyeS6lf1/O0qPJ6s10N4GdciB2WtolAcPG7mlaKFOroUWdOGyfpfl IMLdwCZFN27QcSXfrJ7c =W6WF -----END PGP SIGNATURE-----