SlideShare a Scribd company logo
1 of 92
Download to read offline
Kennismaking met WAI-ARIA
en de Accessibility Tree
Roel Van Gils (Fronteers,28 September 2017)
Web
Accessibility
Initiative
Accessible
Rich Internet
Applications
ARIA is op zich niets
meer dan een hele hoop
HTML-attributen die we
roles en properties
noemen.
aria-role="checkbox"
aria-checked="true"
aria-hidden="true"
ARIA Landmarks
<header role="banner">
Naam, logo en tagline
</header>
<nav role="navigation">
Lijst met navigatie-items
</nav>
<main role="main">
Eigenlijke inhoud
</main>
<aside role="complementary">
Aanvullende info
</aside>
<footer role="contentinfo">
Footer
</footer>
!
Kleine instinker
<ul role="navigation">
<li><a href="…">Home</a></li>
<li><a href="…">Over Ons</a></li>
<li><a href="…">Contact</a></li>
</ul>
!
Kleine instinker
<ul role="navigation">
<li><a href="…">Home</a></li>
<li><a href="…">Over Ons</a></li>
<li><a href="…">Contact</a></li>
</ul>
!
Navigatie [tab] Home [tab] Over ons [tab] Contact
[tab] Item etc.
!
Beter!
<nav role="navigation">
<ul>
<li><a href="…">Home</a></li>
<li><a href="…">Over Ons</a></li>
<li><a href="…">Contact</a></li>
</ul>
</nav>
!
Beter
<nav role="navigation">
<ul>
<li><a href="…">Home</a></li>
<li><a href="…">Over Ons</a></li>
<li><a href="…">Contact</a></li>
</ul>
</nav>
!
Beter
<nav role="navigation">
<ul>
<li><a href="…">Home</a></li>
<li><a href="…">Over Ons</a></li>
<li><a href="…">Contact</a></li>
</ul>
</nav>
!
Navigatie [tab] Lijst met twee items [tab] Item 1: Home
[tab] Item 2: Over ons [tab] Etc.
Welk andere problemen
lost ARIA op?
— HTML heeft een beperkt aantal elementen en
attributen om interactieve componenten te bouwen
— Dat lossen we al jaren op met JavaScript
— JavaScript heeft ons vele mooie dingen gebracht
— Client-sided validatie
— Modal dialogs en tabbed interfaces
— Date pickers
— Carrousels
☠
Carrousels
'Why' ARIA?
Context
Accessibility in twee
minuten
Technologie toegankelijk
maken voor iedereen,zonder
aannames te maken over wat
mensen kunnen of hebben.
'Your missing 20%'
! "
Good design = POUR design
— Perceivable
— Operable
— Understandable
— Robust
A11y is een team effort
Front-end web
development
Terug naar ARIA
Drie Aha-momentjes
Drie Aha-momentjes
1. Pagina-semantiek
2. Focus management
3. De Accessibility Tree
Accessibility Tree
Aanzetten in Chrome
— In Chrome, ga naar chrome://flags/
— Zoek naar Developer Tools Experiments en klik op
Enable
— Open DevTools met ⌥ + ⌘ + i en vink Accessibility aan
in Settings
Voorbeeld 1
Tooltips
Screenreader Demo
Gebruikte ARIA-attributen
— role="tooltip"
— aria-describedby="[IDREF]"
<fieldset>
<legend>Aanmelden</legend>
<div>
<label for="username">Gebruikersnaam</label>
<input type="text" id="username"
aria-describedby="username-tip" required="">
<div role="tooltip" id="username-tip">
Je gebruikersnaam is je e-mailadres
</div>
</div>
<div>
<label for="password">Wachtwoord</label>
<input type="text" id="password"
aria-describedby="password-tip" required="">
<div role="tooltip" id="password-tip">
Wachtwoord vergeten? Klik op 'Nieuw wachtwoord aanvragen'
</div>
<p><a href="#">Nieuw wachtwoord aanvragen</a></p>
</div>
</fieldset>
Voorbeeld 2
Formulieren
Screenreader Demo
Gebruikte ARIA-attributen
— aria-hidden
— aria-label
— aria-labelledby
— aria-describedby
Voorbeeld 3
Live-updates
Screenreader Demo
Gebruikte ARIA-attributen
— role="alert"
— aria-live="assertive|polite|off"
<section id="offline-alert">
<div id="status"
aria-live="assertive" role="alert"
class="online">Niks aan de hand.
</div>
</section>
aria-live="polite"
Screenreader leest gewijzigde tekst van zodra hij klaar is met
praten. Beleefd dus.
aria-live="assertive"
Sreenreader spreekt de gewijzigde tekst onmiddellijk uit.
Als hij bezig was andere tekst uit te spreken, wordt die
onderbroken.
Atomic versus relevant
— Met aria-atomic=true (default) wordt alles binnen
de Live Region voorgelezen als de textContent verandert.
— Met aria-relevant=true worden enkele
toevoegingen opgelezen.
Opgelet!
— role="alert" is een impliciete (polite) live region
— De Live Region container moet al deel zijn van de
pagina's; er zijn issues met dynamisch genereren
Toepassingen
— De veranderde totaalprijs in een boodschappenmandje
— Waarschuwing als max. aantal karakters in een tweet
bereikt is
— Het aantal resultaten bij filters / facetnavigatie.
— Notification banners (zonder OK-knop)
— Chat bots
Opgelet!
Aria-live is handig en de support is goed. Overdrijf er echter
niet mee.
WARNING
alert alertdialog button
checkbox dialog gridcell
link log marquee
menuitem menuitem
checkbox
menuitem radio option
radio scrollbar slider
tab tabpanel textbox
timer tooltip
De knop
<mijnKnop>Sign up<!</mijnKnop>
<mijnKnop class="fancy">Sign up</mijnKnop>
.fancy {
display: inline-block;
color: white;
background: blue;
padding: 20px;
font: 20px sans-serif bold;
border-radius: 8px;
border: none;
cursor: pointer;
}
<mijnKnop class="button"
tabindex="0">Sign up</mijnKnop>
<mijnKnop class="button" role="button"
tabindex="0">Sign up</mijnKnop>
Computer says no
var buttons = Array.from(document.querySelectorAll('[role=button]'));
buttons.forEach(function(button) {
button.addEventListener('click', function() {
doeIetsNuttigs();
});
button.addEventListener('keyup', function(event) {
if (event.key == ' ') or (event.key == 'Enter') {
doeIetsNuttigs();
}
});
});
Doe-het-zelf Checklist
— Gebruik de juiste role (role=button in dit geval)
— Voeg tabindex=O toe zodat de knop bereikt kan
worden zonder muis
— Voeg stijlen toe voor :focus en :hover
— Vang niet enkel click events op, maar ook keyup
events!
Meer leren?
A11ycasts op YouTube = de max
Onthouden
1. Wijzig native semantics niet als het niet nodig is
2. ARIA is niet magisch: zorg ervoor dat interactieve
elementen bereikbaar en activeerbaar zijn
3. Check je Accessibility Tree
4. Tijd over? Check met NVDA, Jaws of VoiceOver. Handig
op iPad!
5. aria-live is handig, maar gebruik het met mate
Einde / Vragen
— @roelvangils op Twitter
— roel@11ways.be

More Related Content

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Kennismaking met WAI-ARIA en de Accessibility Tree