Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 main element versus ARIA landmark role="main"

I'm interested to learn more about the relationship, and possible distinctions, between the HTML5 <main> element, and the ARIA landmark role attribute role="main".

I'm under the impression that the purpose of the <main> element is to map the ARIA roll attribute role="main" onto a specific HTML element. But does that sum it up?

Are there benefits to using <main> over, say, <div role="main">? Or will these, for now and the foreseeable future, yield the same result?

Any insights in comparing the following examples would be greatly appreciated:

<body>   <main>     <p>Paragraph</p>   <main> </body> 

<body>   <main role="main">     <p>Paragraph</p>   <main> </body> 

<body>   <div role="main">     <p>Paragraph</p>   <div> </body> 
like image 203
Stuart Kershaw Avatar asked Oct 25 '13 17:10

Stuart Kershaw


People also ask

What is ARIA landmark roles?

A landmark is an important subsection of a page. The landmark role is an abstract superclass for the aria role values for sections of content that are important enough that users will likely want to be able to navigate directly to them. Note: The landmark role is an abstract role.

Is Main a landmark element?

When there is more than one main landmark on a page, each should have a unique label. A role="main" attribute is used to define a main landmark.

Is Main a landmark element in HTML?

HTML5 elements such as main , nav , and aside act as landmarks, or special regions on the page to which screen readers and other assistive technologies can jump.

What is a main landmark Accessibility?

A main landmark provides a navigation point to the primary content of the page for users of assistive technologies. Most pages only need one main landmark, but in the case of portals or mashups, there may be more than one main landmark on a "page".


1 Answers

According to HTML5 Doctor they are equivalent. <main> just makes it easier and neater to implement role="main".

The primary purpose of is to map ARIA’s landmark role main to an element in HTML.

Here is a general description of the <main> element.

The main element represents the main content of the body of a document or application. The main content area consists of content that is directly related to or expands upon the central topic of a document or central functionality of an application.

Recommendation

It is recommended to use use both <main> and role="main" in the same element until browsers implement <main> properly.

<!-- Recommended --> <main role="main">     ... </main> 

Be sure to read the <main> spec if you're interested.

Note on sectioning

As Szabolcs points out in the comments, <main> is not a sectioning element so it should be used in conjunction with a <section> element.

References

  • The main element - HTML5 Doctor
  • W3C HTML Editors Draft
like image 77
Daniel Imms Avatar answered Sep 24 '22 04:09

Daniel Imms