HTML5News

HTML 5.1 draft spec gets ‘main’ element

Debate continues about marking up a page’s primary content

The HTML 5.1 draft spec now includes the ‘main’ element.

According to the spec, the element, “represents the main content section of the body of a document or application”. The said section “consists of content that is directly related to or expands upon the central topic of a document or central functionality of an application”. In the current definition, there must be only one main element per document, and it must not be a child of header, footer, article, aside or nav.

The Paciello Group (TPG) technical director Steve Faulkner is one of the main advocates of main, and has worked hard to get it into the draft spec. He told .net it was a logical addition based on common mark-up patterns and responding to authors regularly identifying an area of the page as its main content. 

“Authors use a div with a descriptive id value like main, using it as a styling hook. Some also use this as a semantic identifier using an ARIA [accessible rich internet application] role=main, which provides identification and navigation benefits for assistive technology users. Furthermore, authors use it as the target for skip links, which provide keyboard users with a method to move directly to the main content, bypassing link menus," he said. 

Faulkner said the main element builds on these practices, "building in the semantic identifier so authors do not have to bolt it on”. He said it encourages browser vendors to “provide a simple built-in method for users to navigate to the main content area, removing the need for authors to add a skip link manually”.

HTML5 spec editor Ian Hickson remained unconvinced, citing the wide variety in how authors mark-up main content and what they even consider main content. Because of this, he was concerned “users will find main won’t work reliably,” and it would be the “luck of the draw” each time they hit the move to main landmark key whether it worked or not.

Hickson also argued that if HTML was used fully, you implicitly mark up what’s important, because it’s “everything you didn't mark up as an aside, a header, a navigation block, etc., and so browsers could already skip to the next bit of important content, without any changes to the mark-up language at all”.

According to Faulkner, this argument “doesn’t hold water”. He added: “In an idealised world, it may be so, but looking at real-world mark-up patterns, the informal identification of the main content using a div and id is a much more accurate indicator of the primary content area within a page than the Scooby Doo algorithm. The main element takes advantage of this to provide benefits to both users and developers.”

Log in to Creative Bloq with your preferred social network to comment

OR

Log in with your Creative Bloq account

site stat collection