[whatwg] A plea to Hixie to adopt <main>

Henri Sivonen hsivonen at iki.fi
Mon Dec 3 08:25:57 PST 2012


On Wed, Nov 7, 2012 at 8:13 PM, Kang-Hao (Kenny) Lu <kanghaol at oupeng.com> wrote:
> Hixie's another argument, if I understand correctly, is to use <article>
> in place of this role. I think the Web is probably full of mis-used
> <article> already such that using the first <article> in document order
> has no chance to work out, but it would nice if this can be verified,
> even though I can already imagine that an author is unlikely to mark up
> the main content with <article> when the main content isn't an article
> in English sense.

What you say makes sense as a generalization of <main> into <article>
that arises as soon as one thinks of how to write processing rules for
the case where a page has more than one <main> even if it isn’t
supposed to have more than one <main>. However, there are at least
four problems with the “first <article>” rule:

 1) The generalization no longer looks the way authors think. The
cowpath being paved is hard to recognize. That is, the idea that you
replace <div id=content> or <div id=main> with <main> is more
intuitive than that you replace <div id=content> with <article> but
you also replace each <div class=comment> with <article> and since the
comments come after the main article, the first <article> ends up
having the semantics of main content.

 2) When role="main" exists, it’s hard to convince people that
implicit works as well as explicit. Even if browsers actually exposed
the right accessibility API role for first <article>, authors would
still probably feel it’s better to say role="main" just in case. I
would love to see ARIA obsoleted in the sense that people who don’t
retrofit accessibility to legacy code and who aren’t recreating GUI
widgets is JS wouldn’t need to deal with ARIA (where including
role=main just in case because one doesn’t trust rules like “first
<article>” counts as “needing” to deal with ARIA).

 3) Even though in principle, the element names are just runes whose
meaning is given by the spec—not by the English meaning of the element
name, people still try to guess usage from the element name. It’s
pretty easy to believe from element names alone than <main> is <div
id=content> or <div id=main> made as a part of the language itself.
It’s harder to grok the defined semantics of <article> from its
element name.

 4) It’s more obvious to write main { ... } in CSS than
article:first-of-type { ... }

I think it was unfortunate that <main> didn’t make it to the same
round of added elements as <header>, <footer>, <nav> and <aside>. But
it’s not too late to add it—browsers update faster than they used to.

Steve’s research suggests that role=main is the most popular ARIA
landmark. Hixie’s own research data from 2005 shows that there’s a
stronger cowpath to be paved than in the case of some other
landmarkish elements when you consider class=content and stronger than
any of the other landmarkish elements when you sum class=content and
class=main together:
https://developers.google.com/webmasters/state-of-the-web/2005/charts/top20-classes.svg

-- 
Henri Sivonen
hsivonen at iki.fi
http://hsivonen.iki.fi/


More information about the whatwg mailing list