Slide 1
Lost in Translation Manuel Matuzović
Paris Web, Paris 2022
@mmatuzo
Slide 2
@mmatuzo Speaking at React Finland 2019
Slide 3
Source: alistapart.com/article/my-accessibility-journey-what-ive-learned-so-far
@mmatuzo
Slide 4
Source: alistapart.com/article/my-accessibility-journey-what-ive-learned-so-far
@mmatuzo
Slide 5
Slide 6
Source: buttoncheatsheet.com
@mmatuzo
Slide 7
Source: info.cern.ch/hypertext/WWW/MarkUp/Tags.html
@mmatuzo
Slide 8
Slide 9
We are not as good at writing HTML as we think we are. @mmatuzo
Slide 10
<main> <section id=”main-content”> <header id=”main-header”> <section class=”container-fluid”> <section class=”row”> <article class=”content col-sm-12”> <section class=”content-inner”> <div class=”content__body”> <article class=”slider”> <section class=”slide”> … </section> </article> </div> </section> </article> </section> </section> </header> </section> </main>
Source: https://www.htmhell.dev/10-section-is-no-replacement-for-div
@mmatuzo
Slide 11
Source: htmhell.dev
@mmatuzo
Slide 12
Slide 13
<h1>Product Status</h1> <h2>Is the product available?</h2> <div> <h3> <div> <div> <i> <h3> It‘s <a>available</a>. </h3> </i> </div> </div> </h3> </div> Source: https://www.htmhell.dev/19-heading-in-the-wrong-direction/
@mmatuzo
Slide 14
<div class=”btn”>Click here!</div>
@mmatuzo
Slide 15
The Elements of HTML 1. <div> 2. <script>
That’s it, that’s all. #yolo
@mmatuzo
Slide 16
The Elements of HTML 1. <header>
10. <summary>
19. <ins>
2. <footer>
11. <dialog>
20. <caption>
3. <main>
12. <address>
21. <track>
4. <section>
13. <button>
22. <output>
5. <article>
14. <blockquote>
23. <label>
6. <aside>
15. <abbr>
24. < eldset>
7. <progress>
16. <kbd>
25. <textarea>
8. <meter>
17. <mark>
26. <video>
9. <details>
18. <del>
27. …
fi
@mmatuzo
Slide 17
Source: codepen.io/plfstr/full/zYqQeRw
@mmatuzo
Slide 18
Designers know too little about HTML.
@mmatuzo
Slide 19
Some people just don’t care.
@mmatuzo
Slide 20
<div class=”nav”> <div> <div>about</div> <div>thoughts</div> </div> </div>
Source: htmhell.dev/18-main-divigation
@mmatuzo
Slide 21
<div class=”nav”> <a href=”/about”> <button>about</button> </a> <a href=”/thoughts”> <button>thoughts</button> </a> </div>
@mmatuzo
Slide 22
We put too much trust and hope in ARIA.
@mmatuzo
Slide 23
Source: webaim.org/projects/million/
@mmatuzo
Slide 24
Home pages with ARIA present averaged 70% more detected errors than those without ARIA.
Source: webaim.org/projects/million
@mmatuzo
Slide 25
Slide 26
If you can use a native HTML element or attribute with the semantics and behavior you require already built in, instead of re-purposing an element and adding an ARIA role, state or property to make it accessible, then do so. Source: w3.org/TR/using-aria
@mmatuzo
Slide 27
Use native HTML if possible. No ARIA is better than bad ARIA.
@mmatuzo
Slide 28
Source: web.dev/website-navigation
@mmatuzo
Slide 29
Slide 30
Slide 31
Most common issues
Source: webaim.org/projects/million
@mmatuzo
Slide 32
Source: hidde.blog/common-a11y-issues
@mmatuzo
Slide 33
Source: christianheilmann.com/2022/04/12/one-million-broken-web-sites-and-a-way-to-prevent-that
@mmatuzo
Slide 34
Most common issues • Low contrast text • Missing alternative text for images • Empty links • Missing form input labels • Empty buttons • Missing document language
Slide 35
We’re wrongfully downplaying the complexity of HTML due to the simplicity of its syntax. @mmatuzo
Slide 36
There’s more to HTML than tags and attributes.
@mmatuzo
Slide 37
Most common issues • Low contrast text • Missing alternative text for images • Empty links • Missing form input labels • Empty buttons • Missing document language
Slide 38
Accessibility issues don’t just come from what’s visible in a design, but from what’s not visible. @mmatuzo
Slide 39
Design to Code Translation
Exploration
Understanding
Development
@mmatuzo
Slide 40
Design to Code Translation
Lack of knowledge
💥 Exploration
Understanding
Development
@mmatuzo
Slide 41
Design to Code Translation
Lack of knowledge
💥💥 Exploration
Understanding
Not caring
Development
@mmatuzo
Slide 42
Design to Code Translation
Lost in Translation
Lack of knowledge
💥 Exploration
💥💥 Understanding
Not caring
Development
@mmatuzo
Slide 43
Our decisions have consequences • Basic understanding • Information • Orientation • Overview • Navigation
Slide 44
Slide 45
Slide 46
Slide 47
Slide 48
Slide 49
❌
<svg> <path d=”” /> </svg>
@mmatuzo
Slide 50
❌
<div class=”btn”> <svg> <path d=”” /> </svg> </div>
@mmatuzo
Slide 51
❌
<button> <svg> <path d=”” /> </svg> </button>
@mmatuzo
Slide 52
❌
<button aria-label=”Change theme”> <svg aria-hidden=”true”> <path d=”” /> </svg> </button>
@mmatuzo
Slide 53
❌ <button> Change theme <svg aria-hidden=”true”> <path d=”” /> </svg> </button>
@mmatuzo
Slide 54
❌ <button> <span class=”sr-only”>Change theme</span> <svg aria-hidden=”true”> <path d=”” /> </svg> </button>
@mmatuzo
Slide 55
✅ <button aria-expanded=”false”> <span class=”sr-only”>Change theme</span> <svg aria-hidden=”true”> <path d=”” /> </svg> </button>
@mmatuzo
Slide 56
✅ <button aria-expanded=”false” aria-controls=”theme-panel”> <span class=”sr-only”>Change theme</span> <svg aria-hidden=”true”> <path d=”” /> </svg> </button>
@mmatuzo
Slide 57
The Perfect Button • Focusable, interactive element (<button>)
Slide 58
The Perfect Button • Focusable, interactive element (<button>) • Accessible name (a label)
Slide 59
The Perfect Button • Focusable, interactive element (<button>) • Accessible name (a label) • Correct role (button)
Slide 60
The Perfect Button • Focusable, interactive element (<button>) • Accessible name (a label) • Correct role (button) • Communicate state ([aria-expanded])
Slide 61
The Perfect Button • Focusable, interactive element (<button>) • Accessible name (a label) • Correct role (button) • Communicate state ([aria-expanded]) • Communicate relationship ([aria-controls])
Slide 62
Slide 63
Slide 64
Slide 65
Source: htmhell.dev/20-close-buttons
@mmatuzo
Slide 66
❌
<button aria-expanded=”true” aria-controls=”theme-panel”> ✕ </button>
@mmatuzo
Slide 67
✅ <button aria-expanded=”true” aria-controls=”theme-panel”> <span class=”sr-only”>Close</span> <span aria-hidden=”true”> ✕ </span> </button>
@mmatuzo
Slide 68
Slide 69
Source: nordbayern.de
@mmatuzo
Slide 70
Source: natur-im-siedlungsraum.ch
@mmatuzo
Slide 71
Source: nabu-hadamar.de
@mmatuzo
Slide 72
Slide 73
Slide 74
Slide 75
Slide 76
<h1>
<h2> (Featured Posts)
@mmatuzo
Slide 77
<h2> (Most Viewed Posts)
@mmatuzo
Slide 78
<h2> (Most Viewed Posts)
<h2> (Most Commented Posts)
@mmatuzo
Slide 79
A Sound Document Outline • Meaningful labels • Clean hierarchy (Avoid skipping levels) • Enough but not too many headings
Slide 80
Slide 81
Slide 82
Slide 83
<header> <nav> <main>
@mmatuzo
Slide 84
Slide 85
Source: smashingmagazine.com/2022/06/voice-control-usability-considerations-partially-visually-hiddenlink-names
@mmatuzo
Slide 86
<section aria-label=”Quick summary” class=”article__summary”> <span id=”article__start” class=”summary__heading” aria-hidden=”true”> Quick summary ↬ </span> Overcorrecting for one form of disability may… </section>
@mmatuzo
Slide 87
Slide 88
<!DOCTYPE html> <html lang=”de”> <head> <meta charset=”UTF-8”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0”> <title>Ein div ist keine Schaltfläche</title> </head> <body> <h1>Ein div ist keine Schaltfläche</h1> </body> </html>
@mmatuzo
Slide 89
<!DOCTYPE html> <html lang=”de”> <head> <meta charset=”UTF-8”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0”> <title>Ein div ist keine Schaltfläche</title> </head> <body> <h1>Ein div ist keine Schaltfläche</h1> </body> </html>
@mmatuzo
Slide 90
The lang Attribute • Screen readers • Hyphenation • Quotation marks • Spell checking • The default font selection for CJK languages • Translation
Slide 91
Slide 92
Developers, prioritise HTML!
@mmatuzo
Slide 93
Learn who your users are and how they’re using the web.
@mmatuzo
Slide 94
Stop belittling HTML.
@mmatuzo
Slide 95
Universities, schools, teachers, course coordinators, prioritise HTML! @mmatuzo
Slide 96
Rewrite your curriculums, they don’t work.
@mmatuzo
Slide 97
Authors, prioritise HTML!
@mmatuzo
Slide 98
Write and speak more about HTML.
@mmatuzo
Slide 99
Use accessible HTML in your demos.
@mmatuzo
Slide 100
Learn how to test your sites with automatic testing tools.
@mmatuzo
Slide 101
96.8% of home pages had detected WCAG 2 failures!
Source: webaim.org/projects/million
@mmatuzo
Slide 102
Learn how to test your sites with the keyboard and screen readers. @mmatuzo
Slide 103
Slide 104
Slide 105
Additional Resources
@mmatuzo
Slide 106
Source: htmhell.dev/20-close-buttons
@mmatuzo
Slide 107
Source: htmhell.dev/11-the-trigram-for-heaven
@mmatuzo
Slide 108
Source: htmhell.dev/26-tasty-buttons
@mmatuzo
Slide 109
Source: matuzo.at/blog/lang-attribute
@mmatuzo