Ember London meetup, April 2016
Most HTML elements have roles that define their purpose
<img>
elementHas a default implicit role of "graphic" or "image"
<img src="tequila.png" alt="Chamuco's tequila">
<main>
elementHas a default implicit role of "main"
<main>
<h1>Tequila</h1>
...
</main>
<span>
and <div>
elementsHave semantically neutral default implicit roles
<span>Plain text</span>
Some HTML elements can be given accessible names to identify them
<a>
elementAccessible names can be the content of an HTML element
<a href="http://tink.uk">Tink UK</a>
<img>
elementAccessible names can be assigned using HTML attributes
<img src="tequila.png" alt="Chamuco's tequila">
<label>
elementAccessible names can be assigned using associated HTML elements
<label for="username">Username</label>
<input type="text" id="username">
Many HTML elements have associated states
required
attributeIndicates when a form input is required
<input type="checkbox" id="terms" required>
<label>Accept terms</label>
Interactive HTML elements come with keyboard support
<a>
elementCan be focused on with the tab key, and activated with the enter key
<a href="http://tink.uk">Tink UK</a>
<button>
elementCan be focused on with the tab key, and activated with the space or enter key
<button>Tequila</button>
<input type="checkbox" for="bold">
<label for="bold">Bold</label>
The relationship between platform objects and web objects is documented in the HTML AAM
30+ roles including:
Attributes for providing accessible names and descriptions:
9 states including:
App.TequilaButtonComponent = Ember.Component.extend({
tagName: 'tequila-button',
nameBinding: 'tequila.name',
attributeBindings: ['tabindex'],
answer: false,
label: function() { return "Is " + this.get('name') + " tequila good?"; }
.property('name'),
tabindex: 1,
click: function(event) { alert('Yes'); }
});
<tequila-button tabindex="1" class="ember-view" id="ember260">
<script type="text/x-placeholder" id="metamorph-2-start"></script>
Is Reposado tequila good?
<script type="text/x-placeholder" id="metamorph-2-end"></script>
</tequila-button>
App.TequilaButtonComponent = Ember.Component.extend({
tagName: 'tequila-button',
nameBinding: 'tequila.name',
attributeBindings: ['label:aria-label', 'tabindex'],
answer: false,
label: function() { return "Is " + this.get('name') + " tequila good?"; }
.property('name'),
tabindex: 0,
ariaRole: 'button',
click: function(event) { alert('Yes'); },
keyDown: function(event) {
if (event.keyCode == 13 || event.keyCode == 32) { this.click(event); }
}
});
<tequila-button role="button" tabindex="0" aria-label="Is Reposado tequila good?"
class="ember-view" id="ember260">
<script type="text/x-placeholder" id="metamorph-2-start"></script>
Is Reposado tequila good?
<script type="text/x-placeholder" id="metamorph-2-end"></script>
</tequila-button>
Use the Ember a11y test suite within the Ember framework.
Use Ember Cli to install Ember a11y testing as an add-on:
ember install ember-a11y-testing
Call the a11yTest
method from inside an assertion:
test('Home page passes a11y tests', function(assert) {
visit('/');
andThen(function() {
assert.ok(a11yTest());
});
});
Pass a configuration object to run specific tests:
test('Home page passes a11y tests', function(assert) {
visit('/');
andThen(function() {
assert.ok(a11yTest({
allActionsFocusable: false
}));
});
});
Use the Tenon API with your build tools
Install a Tenon module for Grunt, Gulp or other environments
Send a post request to the API with required parameters:
Choose optional parameters such as:
The Ember-axe plugin can be used to test accessibility within Ember
Abandon your mouse, turn on a screen reader, zoom in/out
Questions?