Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 How To Skip Navigation When Name Attribute Is Obsolete

Tags:

html

In the Web Content Accessibility Guidelines is states that you should supply a "skip" link that jumps you (for example) over a navigation block and straight into the content. This is particularly useful for impaired users who use a screen-reader to describe a page audibly.

6.2 Grouping and bypassing links WCAG Guidelines

However, this technique relies on using the name attribute on an anchor tag:

<h2><a name="content">Content</a></h2> 

Along with the skip-to link:

<a href="#content">Skip to content</a> 

The problem is, the "name" attribute of the anchor tag is obsolete in HTML5. HTML Obsolete Features

Is there any other way to achieve this "skip to" functionality without using the name attribute?

Footnote: The status of the HTML5 specification in still in draft and it is possible that the name attribute will actually continue to be allowed in this scenario - although it will probably still generate a "warning". It has currently been marked as "obsolete but conforming", which means you COULD still use it - however, I would like to know of other ways to perform the "skip to" to see if there is a way to do it that doesn't rely on an obsolete attribute.

like image 850
Fenton Avatar asked Jun 14 '10 10:06

Fenton


People also ask

Is name attribute deprecated HTML5?

Permitted attributes Specifies that its a element is a named hyperlink , with the name given by the value of this attribute. The name attribute on the a element is obsolete.

Which element is obsolete in HTML5?

Some attributes from HTML4 are no longer allowed in HTML5 at all and they have been removed completely. img and iframe. caption, iframe, img, input, object, legend, table, hr, div, h1, h2, h3, h4, h5, h6, p, col, colgroup, tbody, td, tfoot, th, thead and tr. table, tr, td, th and body.


1 Answers

Instead of using <a> tags, you can use any element with the id attribute:

<h2 id="content">Content</h2>  <a href="#content">Skip to content</a> 

EDIT, found you a source (albeit it's Wikipedia ;-)):

Alternatively (and sometimes concurrently), with the name or id attributes set, the element becomes a target. A Uniform Resource Locator can link to this target via a fragment identifier. Any element can now be made into an anchor by using the id attribute,[2] so using <a name="foo"> is not necessary.

http://en.wikipedia.org/wiki/HTML_element#Anchor

like image 116
Andy E Avatar answered Sep 28 '22 04:09

Andy E