Top Tips
A look at some of the most common accessibility problems.
Add alt text to images
Problem
- Images, photos, and graphics are unusable by screen reading programs unless they are assigned alternative text.
Example 1
Bad
<img src="Uni life">
Good
<img src="students.jpg" alt="Students socializing on the South Lawn">
Example 2
Bad
<img src="graph-1.jpg" alt="Percentage of primary school students studying Languages, 2007–13" >
Good
<img src="graph-1.jpg" alt="Percentage of primary school students studying Languages, 2007–13. The percentage of primary school students studying Languages has dropped from 73.6% in 2007 to 55.5% in 2012 and then increased again to 62.6% in 2013.">
Example 3
Bad
<img src="graph.jpg" alt="Graph showing primary school language programs" >
Good
<img src="graph.jpg" alt="Figure 3.1. Percentage of primary schools providing Languages programs, by year level, 2007–13. Higher year levels appear to provide more Languages programs. Each calendar year the percentage of schools has dropped with the lowest point in 2012 (averaged around 50%), which increased again to an approximated average of 60% in 2013.">
Tips for Adding Alt Text
- If the image conveys content, add alt text.
- If the image is purely decorative, add null alt text (alt="").
- When deciding whether an image is purely decorative, ask yourself the following:
- Why was the image chosen?
- Is the content in the image already described in the surrounding text?
- Don't be too brief and don't be too literal.
Practice Exercise
WCAG Success Criterion
WCAG Sufficient Techniques
- G94: Providing short text alternative for non-text content that serves the same purpose and presents the same information as the non-text content
- G95: Providing short text alternatives that provide a brief description of the non-text content
Testing Method
- Install the SiteImprove Accessibility Checker.
- Click on the SiteImprove icon in the browser toolbar.
- Examine the report to see if there are any errors under 'Non-text Content'.
Headings
Problem
- 64% of screen reader users use headings to navigate the page, whereas only 8.5% read through the page.
If headings are not included in the page, users are forced to listen to the entire contents of the page.
Example
Bad
<b>WCAG Success Criteria</b>
Good
<h3>WCAG Success Criteria</h3>
Tips for Creating Better Headings
- Headings should be short and concise
- Headings should only be used when followed by content
- By reading the headings alone users should get a good idea of the page contents
- Headings should be mainly used for page specific content, rather than content which appears on every page
- Heading tags should not be used to change font size or add emphasis.
- Appearance and presentation of text should be controlled via CSS rather than heading tags
- Heading levels can't be skipped i.e. you can't jump from <h1> to <h3>
- The contents of <h1> tag is of moderate importance to search engines
- Keywords in <h2> - <h6> tags are of low importance to search engines, but are of key importance to screen reader users
- Identification of structural elements of web pages, such as banners, menus and footers, are best achieved via the use of WAI-ARIA Landmarks
Testing Method
- Open Google Chrome
- Install the HeadingsMap extension
- A new icon will appear in the Chrome toolbar.
- Scan the page and guess which text is a heading.
- Click on the HeadingsMap icon to view the page headings.
- Do the headings match what you thought?
- Is anything missing?
- Tip: Problems are highlighted in red.
Exercise
WCAG Guidelines and Techniques
The Web Content Accessibility Guidelines (WCAG) are the international standard for accessibility.
- 64% of screen reader users use headings to navigate the page, whereas only 8.5% read through the page.
Add a meaningful page title.
Problem
- Users with visual disabilities rely on page titles to identify pages when they have multiple pages open.
Example
Bad
<title>Web Accessibility</title>
Good
<title>My Page Title - Web Accessibility - The University of Melbourne</title>
Tips for Good Page Titles
- Titles should be unique to every page. No duplicates.
- Use page specific information first, then site information.
- Use proper sentences.
Testing Method
- Open Google Chrome
- Install the HeadingsMap extension
- A new icon will appear in the Chrome toolbar.
- Scan the page and think about what the page title should be.
- Click on the HeadingsMap icon to check headings.
- Above the page headings, the page title will be displayed.
- Does the title match what you thought the page title should be?
- Is the page title unique, or is it repeated on multiple pages?
- If you were reading title as a bookmark, would it make sense?
WCAG Guidelines and Techniques
Provide sufficient contrast between text and background colors.
Problem
- Users in general, and particularly those with low vision, have trouble reading text if the contrast against the background is insufficient.
Examples
Good Contrast All the things one has forgotten scream for help in dreams - Elias Canetti All the things one has forgotten scream for help in dreams - Elias Canetti Poor Contrast All the things one has forgotten scream for help in dreams - Elias Canetti All the things one has forgotten scream for help in dreams - Elias Canetti Tips for Creating Better Contrast
- It is much easier to achieve sufficient contrast by using dark text on a light background.
Exercise
Testing Method
- Check contrast using the Color Contrast Analyzer.
WCAG Guidelines and Techniques
- 1.4.3 Contrast
- Text less than 18 point if not bold and less than 14 point if bold
G18: Ensuring that a contrast ratio of at least 4.5:1 exists between text (and images of text) and background behind the text - Text at least 18 point if not bold and at least 14 point if bold
G145: Ensuring that a contrast ratio of at least 3:1 exists between text (and images of text) and background behind the text
Make each page navigable by keyboard alone
Problems
- Screen reader users generally do not use a mouse.
- 40% of people with a motor impairment have difficulty using their hands. Many cannot use a mouse.
Testing Method
- Try tabbing through the page using the keyboard
- Can you select and navigate menus using the arrow keys?
- Do mouse hover states for links and buttons work?
- Can you successfully tab to the end of the page?
- Tip: You can use SHIFT and TAB to tab back up the page
Keyboard Friendly CSS
Wherever you have a style for :hover, make sure that you also have a style for :focus
Bad
/* link styles */
a:link { color: #03c; }
a:visited { color: #606; }
a:hover { color: #c00; }
a:active { color: #600; }
li { margin-bottom: 0.4em; }Good
/* link styles */
a:link { color: #03c; }
a:visited { color: #606; }
a:hover { color: #c00; }
a:focus { color: #600; }
a:active { color: #600; }
li { margin-bottom: 0.4em; }Exercise
- Open a web page that you are familiar with
- Try tabbing through the page from top to bottom
- Can you see which link has focus?
WCAG Guidelines and Techniques
Avoid 'click here' link text.
Problem
- Screen reader users often navigate using a list of links. Unless the link describes the destination, they need more information in order to decide if they want to follow it.
Tips
- Links to web pages should open in the same browser tab.
- Links to PDFs should open in a different browser tab.
- Link text should:
- Describe what it’s linking to
- Be meaningful to your audience
- Be as short as possible, while remaining meaningful.
- Never use generic text such as ‘click here’ or ‘more’ as link text.
Bad
More information about how to find a prospective supervisor can be found here.Better
More about finding a prospective supervisor.Never use a URL as link text (unless you have a particular reason to publicise a URL).
Bad
Read more about the University’s history at https://about.unimelb.edu.au/our-history.Better
Read more about the University’s historyWCAG Guidelines and Techniques
Allow pausing of animations
Problems
- Automatically updating content can be extremely distracting for users with attention difficulties.
- Users will often try and scroll page content in order to remove the animation from their field of view, or will try and look at something else in the room.
Example
Tips
- Allow animations to be paused or stopped.
- Make sure that banner animations don't distract users from the key purpose of the page.
- Users are more likely to click on banner animations on content pages, rather than top level navigation pages.
WCAG Success Criterion
Add captions to video
Problems
- Users who are Deaf or hard of hearing need to read captions of audio, so that they can understand what is being said.
- Auto-captions are not adequate for users in situations where a high degree of accuracy is required.
Example
Tips
Captions should include:
- All words spoken by characters (including stuttering etc).
- Words spoken by a narrator.
- The words to any song.
- Identification for off screen speakers.
- Descriptions of sound events that impact on the story or meaning.
- Sound effects should be shown in square brackets, e.g. [dog barking]
- The speakers name should be identified in round brackets, e.g. (John)
Tools
WCAG Success Criteria
-
Connect Form Labels to Input Fields.
Problem
- Screen readers go into forms mode when they encounter form input fields. Unless form elements are grouped and have labels and instructions linked to them, the screen reader cannot tell the user what data needs to be entered.
Examples
Text Input Field - Example 1 - HTML
The text field in the example below has the explicit label of "First name:". The
label
element'sfor
attribute matches theid
attribute of theinput
element.Incorrect code
First name
<input type="text" id="firstname" />Correct code
<label for="firstname">First name:</label>
<input type="text" id="firstname" />
Text Input Field - Example 2 - WAI-ARIA
The text field in the example below has the explicit label of "First name:". The
label
element'sid
attribute matches thearia-labelledby
attribute of theinput
element.Incorrect code
First name
<input type="text" />Correct code
<div id="firstname">First name:</div>
<input type="text" aria-labelledby="firstname" />
Text Input Field - Example 3 - WAI-ARIA
Sometimes there isn't room to add a visible label on the page. In the example below, the label of "Search" is provided by the
aria-label
attribute of theinput
element.Incorrect code
<input type="text" placeholder="Search" />Correct code
<input type="text" aria-label="Search" />
Example 2: A checkbox
Incorrect code
<input type="checkbox" id="markuplang" name="computerskills" checked="checked">
<p>HTML</p>Correct code
<input type="checkbox" id="markuplang" name="computerskills" checked="checked">
<label for="markuplang">HTML</label>
Example 3: A group of radio buttons
A small, related group of radio buttons with a clear description and labels for each individual element.
Note: To provide clear associations and instructions for a large set of related radio buttons H71: Providing a description for groups of form controls using fieldset and legend elements , should be considered.
Incorrect code
<h1>Donut Selection</h1>
<p>Choose the type of donut(s) you would like then select the "purchase donuts" button.</p>
<input type="radio" name="flavor" id="choc" value="chocolate" />
<label for="choc">Chocolate</label><br/>
<input type="radio" name="flavor" id="cream" value="cream"/>
<label for="cream">Cream Filled</label><br/>
<input type="radio" name="flavor" id="honey" value="honey"/>
<label for="honey">Honey Glazed</label><br/>
<input type="submit" value="Purchase Donuts"/>Correct code
<h1>Donut Selection</h1>
<fieldset>
<legend>Choose the type of donut(s) you would like then select the "purchase donuts" button.</legend>
<input type="radio" name="flavor" id="choc" value="chocolate" />
<label for="choc">Chocolate</label><br/>
<input type="radio" name="flavor" id="cream" value="cream"/>
<label for="cream">Cream Filled</label><br/>
<input type="radio" name="flavor" id="honey" value="honey"/>
<label for="honey">Honey Glazed</label><br/>
<input type="submit" value="Purchase Donuts"/>
</fieldset>
Example 4: Instructions and Validation Messages
Often forms contain additional instructions or validation messages, which describe what to put in a particular input field. Like labels, these need to be connected to the input field.
Incorrect code
<label for="password">Password</label>
<input type="text" id="password" required>
<div>Must be at least 8 characters, contain one uppercase letter and a number</div>Correct code
<label for="password">Password</label>
<input type="text" id="password" aria-describedby="description" required>
<div id="description">Must be at least 8 characters, contain one uppercase letter and a number</div>
Testing Method
- Install the SiteImprove Accessibility Checker.
- Click on the SiteImprove icon in the browser toolbar.
-
Examine the report to see if there are any errors under 'Labels or instructions'.
Screen Reader Testing Tools
Exercises
- Add correct labels to the form fields on this page
- Examine how ARIA can be used to auto-complete input field values
WCAG Guidelines and Techniques