30 Minutes or Less:
The Magic of Automated Accessibility Testing
Marcy Sutton, Seattle, WA Accessibility Engineer, Angular Core Team Member
Slides: http://marcysutton.com/jsconf2015
Accessibility is the answer to a more inclusive Web.
(Pizza is also always the answer.)
Accessibility is about people.
Accessibility Basics
Alternative text
Document structure & hierarchy
HTML semantics
Keyboard interactivity
Color contrast
Focus management
More principles
How to Accessibility
Let tooling to do some heavy lifting for you.
As far as diagnosing low-hanging fruit. Not a substitute for user testing.
Let's talk about:
Manual Testing
Sorta-Automated Testing
Definitely Automated Testing
But automating’s no substitute for...
real user feedback
* Inclusive of people with disabilities
First thing I do:
Tab through a page with the keyboard
Next thing:
Use a screen reader
Let's do an audit
Demo in Canary, show accessibility inspector
https://groups.google.com/a/chromium.org/forum/#!topic/chromium-accessibility/zmWfzZic9fE
Chrome Accessibility Developer Tools
Open Source Audit Library
What do you do with those?
Definitely Automated Testing
by Addy Osmani
var a11y = require ('a11y' );
a11y('cnn.com' , function (err, reports) {
var report = reports.report;
console .log(report);
});
Ways to Integrate
Run on save
Run on commit
Run on deploy
Use on localhost instead of hitting remote URL, add to a task runner, etc.
Grunt-a11y, CI servers
Protractor
Test for:
Focus management
Live updates
Color contrast
Write some tests, deliver some audits
describe('bottom sheet view' , function () {
beforeEach(function () {
element(by.css('button.share' )).click();
});
it('should focus on the first item' , function () {
element.all(by.css('[ng-click="vm.performAction(item)"]' ))
.then(function (items) {
expect(items[0 ].getAttribute('id' ))
.toEqual(browser.driver.switchTo().activeElement().getAttribute('id' ));
});
Runs your tests against
Chrome A11y Developer Tools & Tenon API
Unit Testing for Accessibility
Opportunities:
Watched ARIA properties
Keyboard operability
Text alternatives
Semantics
Example: ngAria
<some-checkbox> custom element
{<br> "role ": "checkbox" ,<br> "ng-model ": "checked" ,<br> "ng-checked ": "checked" ,<br> "class ": "ng-pristine ng-untouched ng-valid" ,<br> "tabindex ": "0" ,<br> "checked ": "checked" ,<br> "aria-checked ": "true" <br> }
Attributes rendered
ngAria Unit Tests
ddescribe('tabindex' , function () {
beforeEach(injectScopeAndCompiler);
it('should not attach to native controls' , function () {
compileElement("<button ng-click=" something"></button>" );
expectAriaAttrOnEachElement(element, 'tabindex' , undefined );
});
it('should attach tabindex to custom inputs' , function () {
compileElement('<div type="checkbox" ng-model="val"></div>' );
expect(element.attr('tabindex' )).toBe('0' );
compileElement('<div role="checkbox" ng-model="val"></div>' );
expect(element.attr('tabindex' )).toBe('0' );
});
it('should attach to ng-click' , function () {
compileElement('<div ng-click="someAction()"></div>' );
expect(element.attr('tabindex' )).toBe('0' );
});
...
Angular.js ngAria (refactor)
Accessibility Testing,
delivered
Keyboard, screen reader
Firefox Web Developer Toolbar
Chrome Accessibility Developer Tools
A11y, Protractor, Unit testing
Let's eat.
30 Minutes or Less:
The Magic of Automated Accessibility Testing
Marcy Sutton, Seattle, WAAccessibility Engineer, Angular Core Team Member
Slides: http://marcysutton.com/jsconf2015