WCAG & Inclusive Design — UI/UX

WCAG 2.2 (W3C's web accessibility standard, 2023) has 4 POUR principles: Perceivable (can be taken in by the senses), Operable (can be operated, keyboard…

Look at the ramp beside the stairs at the mall, a door wide enough for a wheelchair, and lift buttons you can reach from a seat. All of that is there because of the building rules for public buildings: doors at least this wide, ramps at most this steep, lift buttons at this height. Those rules can be measured, and each one can be checked. But a good architect thinks further. They also think of the mother pushing her baby in a pram, the courier carrying boxes, and the grandfather with a sore knee. On the web, those building rules are called WCAG (Web Content Accessibility Guidelines): the international standard from W3C for measuring a page's accessibility, one criterion at a time. The architect's way of thinking, which includes the mother, the courier and the grandfather, is called inclusive design: designing from the start for people who differ.

Four principles: POUR

WCAG 2.2 (a W3C Recommendation, which means an official W3C standard, October 2023) is built from 4 principles, 13 guidelines and 86 success criteria. A success criterion is a rule you can test: a page passes or fails it. Each criterion has a number, such as 1.1.1. The four principles are abbreviated POUR:

Principle Meaning Example from this track
Perceivable the content can be taken in by the senses, whichever sense is used alt for the room photo (1.1.1), 4.5:1 contrast (1.4.3), 200% zoom (1.4.4)
Operable everything can be operated, keyboard included <button>, not <div onclick> (2.1.1), visible focus (2.4.7), 24px touch targets (2.5.8)
Understandable the content and its behaviour can be understood lang="en" (3.1.1), field labels (3.3.2), helpful error messages (3.3.1, 3.3.3)
Robust sturdy enough for assistive technology (tools such as screen readers) to read every component has the right name and role (4.1.2), as in the accessibility tree

Levels A, AA, AAA

Every criterion also has a level: A (31 criteria) is the most basic level, AA (24 more criteria) is the usual target, and AAA (31 criteria) is the strictest.

Four new WCAG 2.2 criteria on Mrs. Sri's page

Mrs. Sri's team added a 72px bar stuck to the bottom of the screen. It holds "2 nights · $70" and the book button. The bar is always visible, so guests don't have to scroll the page to book. Which WCAG 2.2 criterion can the bar break, and what's the fix that takes only one line? Guess before you look at the table.

WCAG 2.2 added 9 criteria and removed one old criterion, 4.1.1 (Parsing). Four of the new criteria apply directly to Mrs. Sri's "Guest details" step, the page where guests fill in their name, their WhatsApp number and the number of guests. It's the same step as in the Lab on this page. We tested it on a 330 × 380px screen in Chromium, WebKit and Firefox.

Criterion Level On Mrs. Sri's page Fix
2.4.11 Focus Not Obscured (Minimum) AA the 72px bar covers the focused field scroll-padding-bottom: 88px
2.5.8 Target Size (Minimum) AA the guest − and + buttons are 18 × 18px, 4px apart 44 × 44px
3.3.7 Redundant Entry A the same name typed twice: the booker and the guest staying a "Same as the booker" tick box
3.3.8 Accessible Authentication (Minimum) AA the 6-digit code from WhatsApp can't be pasted allow paste, autocomplete="one-time-code"

2.4.11. When a component (a button, a field, a link) takes focus, it must not be hidden entirely by content the page's owner added, such as a stuck bar. Without the fix, Tab moved focus to the WhatsApp number field, and the bar hid that field fully in Chromium and WebKit. In Firefox, the field that was fully hidden was the note field. Other fields were partly hidden. The cause: the browser only scrolls until the focused field enters the screen, without knowing there's a bar there. The fix is in W3C's list of techniques: technique C43, scroll-padding. On Mrs. Sri's page, it takes one line of CSS:

html { scroll-padding-bottom: 88px; } /* 72px bar + 16px */

scroll-padding-bottom tells the browser that the bottom 88px of the screen is no place to put the element it is scrolling to, such as a field that has just taken focus. With that line, no field was fully hidden in any of the three browsers. In WebKit, the bar's top edge still covered part of the note field. That passes 2.4.11 but fails 2.4.12 (Enhanced, AAA), the strict version of this criterion, which allows no part to be hidden. So the answer to the guess: 2.4.11. The fix is a scroll-padding-bottom as tall as the bar, plus a little room.

2.5.8. A target (the area you press with a finger or click with a mouse) must be at least 24 × 24 CSS px. Smaller targets still pass on one condition: picture a circle 24px in diameter in the middle of each target, and those circles must not overlap. The guest − and + buttons are 18px with 4px between them, so their centres are only 22px apart (half a button 9px + the 4px gap + 9px). 22px is less than 24px, so their circles overlap and the buttons fail. Made 44 × 44px (Apple's suggested size), the buttons pass without any spacing calculation.

3.3.7. Information already entered in the same process must not be asked for again. The page must fill it in automatically, or offer it as a choice. There are three exceptions: re-entry that really matters (confirming a password, say), security, and old information that's no longer valid.

3.3.8. On the "Guest details" step, a returning guest can sign in with a 6-digit code sent on WhatsApp. Signing in must not require a cognitive function test (a task that asks people to remember, work with or copy information), such as remembering a password or copying a code, unless help is offered. According to W3C's explanation of this criterion, a service which requires a verification code to be copied by hand doesn't meet it. So the guest must at least be able to paste the code, and the browser must be allowed to fill it in automatically. The autocomplete="one-time-code" attribute in the table tells the browser that the field is for a one-time code. A page that refuses a paste by cancelling the paste event (the moment text is pasted) fails here.

Inclusive design: start from people who differ

WCAG gives a floor, a minimum you can measure. Inclusive design asks: who haven't we thought of yet? Microsoft's Inclusive Design Toolkit (Microsoft's guide to inclusive design) splits limitations into three: permanent (one arm), temporary (a broken arm) and situational (holding a baby). All three people can use only one hand, so a solution for one person often helps many. Here are three of Mrs. Sri's guests:

How to check: go through the page with Tab only, zoom to 200%, open it at 320px wide, and try a real screen reader. Automated tools such as axe and Lighthouse help, but they only find some of the problems. A later lesson covers those tools.

⚠️ What keeps a page short of AA

TL;DR: WCAG 2.2 (W3C's web accessibility standard, 2023) has 4 POUR principles: Perceivable (can be taken in by the senses), Operable (can be operated, keyboard included), Understandable (can be understood) and Robust (can be read by assistive technology, such as screen readers). It holds 13 guidelines and 86 criteria you can test. Levels: A (the minimum, 31), AA (24 more, the target for most sites and what rules like the EU's EN 301 549 refer to) and AAA (31, the strictest, not recommended for a whole site). The levels stack: one failing A criterion means not even A. There are four new 2.2 criteria on Mrs. Sri's page. 2.4.11: a bar stuck to the bottom of the screen must not fully hide the focused field, so add a scroll-padding-bottom as tall as the bar. 2.5.8: touch targets are at least 24 × 24px, or 24px circles in their middle don't overlap. 3.3.7: don't ask for re-entry, offer a "Same as the booker" tick box. 3.3.8: don't require copying a code by hand, so allow paste and use autocomplete="one-time-code". Inclusive design (designing from the start for people who differ) thinks of permanent, temporary and situational limitations, such as Mr. Hadi zooming the page to 200%, a guest with a cheap phone and a weak signal, and a tourist reading in a second language. Check with Tab, zoom, a 320px width and a real screen reader.

⚡ POUR

Guess first: WCAG (the web accessibility standard) has four principles: a page can be taken in by the senses, can be operated, can be understood, and is sturdy. They are shortened to POUR. What do the letters stand for?

Perceivable (can be taken in by the senses), Operable (can be operated, keyboard included), Understandable (can be understood) and Robust (can be read by assistive technology, such as screen readers).

Meaning: WCAG 2.2 has 4 principles, 13 guidelines and 86 criteria. Each criterion can be tested, such as the room photo's alt (1.1.1) and 4.5:1 text contrast (1.4.3).

⚡ The target for most sites: AA

Meaning: Every WCAG criterion has a level. A is the minimum, AA the target for most sites, and AAA the strictest. AAA is not recommended for a whole site. The levels stack: AA means every A and AA criterion is met. So one failing A criterion means the page has no level at all.

⚡ A stuck bar hides the focus

Write:

html { scroll-padding-bottom: 88px; } /* 72px bar + 16px */

Meaning: Mrs. Sri's page has a 72px bar stuck to the bottom of the screen, with the total price and the book button. The bar can cover all of the field that has focus, which breaks WCAG 2.4.11. This line of CSS tells the browser that the bottom 88px of the screen is no place to put the element it is scrolling to.

⚡ Inclusive design

Meaning: WCAG gives a floor, a minimum you can measure. Inclusive design (designing from the start for people who differ) asks who we haven't thought of yet: people with permanent (one arm), temporary (a broken arm) and situational (holding a baby) limitations. The 44px touch targets that help Mr. Hadi, a 58-year-old guest, also help a guest booking while standing in a minibus.

What you will learn