three quick accessibility tips for html5

50
Three quick tips for Accessibility and HTML5

Upload: russ-weakley

Post on 19-Aug-2014

4.722 views

Category:

Education


1 download

DESCRIPTION

Three quick accessibility tips for HTML5, including section element, summary attribute and block links.

TRANSCRIPT

Page 1: Three quick accessibility tips for HTML5

Three quick tips forAccessibility and

HTML5

Page 2: Three quick accessibility tips for HTML5

Charles has just given you a broad overview of HTML 5 accessibility.

Page 3: Three quick accessibility tips for HTML5

I am now going to focus on a few quick aspects about HTML5 and accessibility - a micro view.

Page 4: Three quick accessibility tips for HTML5

The <section> element

Page 5: Three quick accessibility tips for HTML5

HTML5 provides us with a range of new “semantic elements”.

Page 6: Three quick accessibility tips for HTML5

<header><nav><section><article><aside><main><footer><figure><figcaption>

Page 7: Three quick accessibility tips for HTML5

The <section> element is used for a “thematic grouping of content” - a chunk of content that has a single theme.

Page 8: Three quick accessibility tips for HTML5

The theme of each section should be identified with a heading element (h1-h6).

Page 9: Three quick accessibility tips for HTML5

<section> <h2> All about apples </h2> ...</section>

Page 10: Three quick accessibility tips for HTML5

The <section> element is not a replacement for a <div>. The <div> element should be always be used for generic containers.

Page 11: Three quick accessibility tips for HTML5

The section element is also available to assistive technologies. The section element is mapped as a region.

Page 12: Three quick accessibility tips for HTML5

For assistive technologies that support HTML5 elements, the <section> element is announced with “Region start” and then “Region end”.

Page 13: Three quick accessibility tips for HTML5

For this reason:1. only use a section element for the intended purpose2. always include a heading

Page 14: Three quick accessibility tips for HTML5

Additional meaning can be applied to the section element using the “aria-labelledby” attribute.

Page 15: Three quick accessibility tips for HTML5

<section aria-labelledby="section-apples"> <h2 id="section-apples"> All about apples </h2></section>

Page 16: Three quick accessibility tips for HTML5

the summary attribute

Page 17: Three quick accessibility tips for HTML5

Some attributes from HTML4 are no longer allowed in HTML5.

Page 18: Three quick accessibility tips for HTML5

One of these is the “summary” attribute which is applied to the <table> element.

Page 19: Three quick accessibility tips for HTML5

The summary attribute is used to provide assistive technologies with additional information about the table.

Page 20: Three quick accessibility tips for HTML5

<table summary="summary here"> ...</table>

Page 21: Three quick accessibility tips for HTML5

A lot of accessibility experts are not happy with this attribute being removed!

Page 22: Three quick accessibility tips for HTML5

So, how can we provide this additional summary information?

Page 23: Three quick accessibility tips for HTML5

The simplest solution is to provide the additonal information directly above or below the table element.

Page 24: Three quick accessibility tips for HTML5

<p> Summary information</p><table> ...</table>

Page 25: Three quick accessibility tips for HTML5

You could get a bit fancier and place all relevant content inside a <figure> element and the additional content inside a <figcaption> element.

Page 26: Three quick accessibility tips for HTML5

<figure> <figcaption> Summary information </figcaption> <table> ... </table></figure>

Page 27: Three quick accessibility tips for HTML5

You could also provide additional meaning by using the “aria-labelledby” attribute.

Page 28: Three quick accessibility tips for HTML5

<figure> <figcaption id="summary1"> Summary information </figcaption> <table aria-labelledby="summary1"> ... </table></figure>

Page 29: Three quick accessibility tips for HTML5

The <a> element

Page 30: Three quick accessibility tips for HTML5

In the past, the <a> element was always considered an inline element.

Page 31: Three quick accessibility tips for HTML5

Inline elements were never allowed to wrap around block level elements.

Page 32: Three quick accessibility tips for HTML5

<p> A simple <a href="#">link</a>.</p>

Page 33: Three quick accessibility tips for HTML5

With HTML5, the <a> element is now allowed to wrap around entire blocks of content - creating a block link.

Page 34: Three quick accessibility tips for HTML5

“The a element may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links).”

Page 35: Three quick accessibility tips for HTML5

<a href="#"> <p> A simple link. </p></a>

Page 36: Three quick accessibility tips for HTML5

But why would this be allowed, when it breaks the very laws of nature?

Page 37: Three quick accessibility tips for HTML5

There may be times when you want to link multiple elements inside a container to the same location - such as a link on a thumbnail, a heading and even some text.

Page 38: Three quick accessibility tips for HTML5

In the past, this meant multiple links going to the same location - which could be confusing for some assistive technologies.

Page 39: Three quick accessibility tips for HTML5

<div> <a href="#"> <img src="a.png" alt=""> </a> <h2> <a href="#"> Heading </a> </h2> <p>Some text</p></div>

Page 40: Three quick accessibility tips for HTML5

By wrapping the <a> element around the entire block, there is only one link required.

Page 41: Three quick accessibility tips for HTML5

<a href="#"> <div> <img src="a.png" alt=""> <h2> Heading </h2> <p>Some text</p> </div></a>

Page 42: Three quick accessibility tips for HTML5

While this can reduce confusion for some assistive technologies, it can make things more confusing for others.

Page 43: Three quick accessibility tips for HTML5

For a full list of all issues, read “HTML5 Accessibility Chops: Block Links”

http://blog.paciellogroup.com/2011/06/html5-accessibility-chops-block-links/

Page 44: Three quick accessibility tips for HTML5

Bottom line:“A link should contain a brief description of the link target... include the key information at the start of a link”

Page 45: Three quick accessibility tips for HTML5

More issues? Some browsers do not display block links correctly.

Page 46: Three quick accessibility tips for HTML5

Issues can include missing underlines, cursor not changing, everything underlined...

Page 47: Three quick accessibility tips for HTML5

A safe way to solve the problem is to apply a class to any instance of block links and then use the following three declarations for the class...

Page 48: Three quick accessibility tips for HTML5

a.block-link{ display: block; text-decoration: none; cursor: pointer;}

Page 49: Three quick accessibility tips for HTML5

So, if you want to use block links, be aware of the potential issues as well is the potential benefits!

Page 50: Three quick accessibility tips for HTML5

Russ WeakleyMax Design

Site: maxdesign.com.auTwitter: twitter.com/russmaxdesignSlideshare: slideshare.net/maxdesignLinkedin: linkedin.com/in/russweakley