Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Léonie Watson

FrontFest
November 21, 2017

Léonie Watson

FrontFest

November 21, 2017
Tweet

More Decks by FrontFest

Other Decks in Programming

Transcript

  1. Developer's guide to accessibility APIs FrontFest, Moscow 2017 Léonie Watson

    ~ The Paciello Group • Mastodon: @[email protected] • Twitter: @LeonieWatson • Blog: tink.uk • Github: https://github.com/ljwatson 1
  2. Windows: Mac OS: Linux: Accessibility APIs UI Automation (UIA) MS

    Active Accessibility (MSAA) IAccessible2 (IA2) OSX Accessibility Protocol (AXAPI) Accessibility Toolkit (ATK) AT Service Provider Interface (AT-SPI) 9
  3. Accessibility mechanics • Browser builds the DOM and a11y tree

    • Screen reader queries the accessibility tree • Browser responds to changes in the DOM, then updates the a11y tree • Screen reader listens for changes in the a11y tree 10
  4. Accessibility API mappings (AAM) Define how role, state, properties, and

    keyboard focus for native elements are handled in the browser • Core Accessibility API Mappings (AAM) 1.1 w3.org/TR/core-aam-1.1 • HTML AMM 1.0 w3.org/TR/html-aam-1.0 • SVG AAM 1.0 w3.org/TR/svg-aam-1.0 11
  5. Using ARIA Attributes that polyfill missing role, name, and state

    information for screen readers • ARIA 1.0: w3.org/tr/wai-aria/ • ARIA 1.1 (Candidate Recommendation): w3.org/tr/wai-aria-1.1/ 18
  6. The role attribute 70+ roles, including: • tablist, tab, tabpanel

    • checkbox, radio, textbox • table, row, cell • toolbar, menu, menubar 19
  7. The aria- attributes 45+ states and properties, including: • aria-invalid

    , aria-required • aria-pressed , aria-expanded • aria-controls , aria-owns 20
  8. Rendered code <details> <summary id="button" role="button" tabindex="0" aria-expanded="false"> Tequila... </summary>

    <div id="content" hidden>Makes me happy!</div>Makes me happy! </details> 27
  9. Add functionality function disclose(event) { if (content.hasAttribute('hidden')) { button.setAttribute('aria-expanded', 'true');

    content.removeAttribute('hidden'); } else { button.setAttribute('aria-expanded', 'false'); content.setAttribute('hidden', 'true'); } } 28
  10. AOM phases 1. Modify the semantic properties of the accessibility

    node associated with a DOM node; 2. Directly respond to events or actions from AT; 3. Create virtual accessibility nodes (not associated with DOM nodes); 4. Programmatically explore the accessibility tree, and access the computed properties of accessibility nodes. 32
  11. AOM Phase 1 Has landed in Chrome Canary behind the

    flag: --enable-blink-features=AccessibilityObjectModel 33
  12. Create the function function disclose(event) { if(content.getAttribute('hidden')) { button.accessibleNode.expanded =

    true; button.accessibleNode.controls = content; content.removeAttribute('hidden'); } else { button.accessibleNode.expanded = false; button.accessibleNode.controls = null; content.setAttribute('hidden', true); } } 41
  13. Thank you! Léonie Watson ~ The Paciello Group • Mastodon:

    @[email protected] • Twitter: @LeonieWatson • Blog: tink.uk • Github: https://github.com/ljwatson 44