Re: change proposal for <main>: possible validation warning heuristic for misuse

Hi James,

The current author conformance errors as per the spec [1] are:
multiple <main> = an error
<main> inside any of the following article, aside, footer, header or nav.
plus any conformace errors related to the elements content model.


On a first pass I consider your suggested additions sensible and will work
with you and others to work out the best way to incorporate them into the
spec.

I also think it is sensible to discuss with mike smith and henri sivonen
about the practicalities of expressing these conformance errors via
conformance checking tools.

regards
Steve

[1]
https://dvcs.w3.org/hg/html-extensions/raw-file/tip/maincontent/index.html

On 30 November 2012 22:41, James Craig <jcraig@apple.com> wrote:

> Despite the <main> element extension specification being approved "with no
> objections and ample support" by the HTML Working Group [1], some arguments
> have been resurrected on a few lists recently, including webkit-dev [2].
>
> While I don't share Ian's concern that misuse or misunderstanding of the
> element will make <main> "pointless", he has a valid concern that there is
> some potential for incorrect use. I personally feel that the penalty for
> such misuse is negligible [3], but we should do everything we can to avoid
> misunderstanding and warn authors about misuse, so I'm proposing a
> heuristic to trigger author validation warning upon detection of probable
> misuse, thereby making the spec for <main> a little bit stronger, and
> address the primary case that I believe is the cause of Ian's concern.
>
> I'll begin by defining what I consider "misuse" of the <main> element.
>
> I'd consider it misuse of <main> to be used as a direct replacement for a
> wrapper element (like <div id="body">) that contains all standard page
> contents, including the navigation and footer, in addition to the actual
> primary content or 'main' content.
>
> Misuse Example:
> <body>
>     <main>
>         <header></header>
>         <nav> … </nav>
>         <div id="primarycontent"> this is the real 'main' content </div>
>         <footer> … </footer>
>     </main>
>     <!-- with possibly some appended dialogs or panels out here -->
> </body>
>
>
> However, there are some times when it would be valid to use <main> as the
> wrapper element with no other programmatically discernible landmarks.
>
> Valid uses of <main> Example 1, with no other discernible landmarks:
> <body> <!-- example: this may be iframe contents -->
>     <main> this is the real 'main' content </main>
> </body>
> <body>
>     <main> this is the real 'main' content </main> <!-- not a misuse of
> main, despite the follow misuse of footer -->
>     <div id="footer"> … </div> <!-- this should be a footer element, but
> that info is not programmatically determinable -->
> </body>
>
>
> Likewise, there are times when it's valid to nest landmarks, so we should
> not trigger a warning for something as simple as a <nav> element inside
> <main>:
>
> Valid use of <main> Example 2, with nested landmarks:
> <body>
>     <header></header>
>     <nav> … </nav>
>     <main>
>         <div id="primarycontent"> this is the real 'main' content </div>
>         <nav> secondary navigation inside main </nav>
>     </main>
>     <footer> … </footer>
> </body>
>
>
> I think, however, we can safely trigger a warning for the error case
> mentioned above, because there are no discernible landmarks outside main
> element, but there are one or more discernible landmarks inside main.
>
> Misuse Example:
> <body>
>     <!-- no discernible landmarks outside main -->
>     <main>
>         <!-- but multiple discernible landmarks inside main -->
>         <header></header>
>         <nav> … </nav>
>         <div id="primarycontent"> this is the real 'main' content </div>
>         <footer> … </footer>
>     </main>
> </body>
>
>
> Explicit ARIA landmarks outside the main element should probably also
> prevent the heuristic from triggering a warning:
>
> Valid use example for main (misuse of header/footer though):
> <body>
>     <div id="header" role="banner"> … </div> <!-- bypasses the warning
> because of the explicit aria landmark role outside main -->
>     <main>
>         <nav> … </nav>
>         <div id="primarycontent"> this is the real 'main' content </div>
>     </main>
>     <div id="footer" role="contentinfo"> … </div> <!-- bypasses the
> warning because of the explicit aria landmark role outside main -->
> </body>
>
>
> I have not yet proposed any specific wording for what will probably end up
> as an RFC-2119 author "SHOULD NOT" requirement, because it deserves more
> discussion first.
>
> Thoughts?
> James
>
>
> 1. HTML WG Approval of <main> extension spec:
> http://lists.w3.org/Archives/Public/public-html/2012Nov/0232.html
>
> 2. Webkit dev thread:
> http://lists.webkit.org/pipermail/webkit-dev/2012-November/023013.html
>
> 3. The penalty for misuse of <main>, with regards to landmark navigation,
> is about the same penalty that users pay when authors hierarchically
> structure headings incorrectly. (e.g. h1, then h3, without an h2 in
> between). Multiple non-linear navigation mechanisms still work, but there
> is a minor loss of clarity in a screen reader user's ability to grok the
> page structure at a high level. In my opinion, this cost is relatively
> trivial compared to the potential wins we get by adding the accessible
> landmark role to the default semantics of the <main> element when used
> correctly.
>
>

Received on Saturday, 1 December 2012 13:14:19 UTC