- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Core Tech
When Web Accessibility Problems Shut People Out
The community services portal is a municipal site where residents browse local services, RSVP to events, and register accounts. A prior contractor shipped it fast and skipped accessibility: low-contrast buttons, an unlabelled div-soup navigation bar, images with no alt text and a captionless video, a modal that traps focus in the wrong order, a drag-only availability slider, a session timer that logs people out without warning, a registration form whose errors are invisible to assistive tech, a venue picker that silently navigates on selection, and dynamic RSVP confirmations that never reach screen reader users. The city's accessibility office has filed a defect list mapped to WCAG 2.2 AA criteria; your job is to work through it component by component until the portal page assembles into something every resident can actually use.
Lab Info
Table of Contents
-
Challenge
Meet the community portal
A community portal that quietly locks people out
The community services portal lets residents browse local services, RSVP to community events, and register accounts. It shipped fast, and it works — for one kind of user. A resident who can't perceive low-contrast text, can't operate a drag-only slider, can't see a modal that silently steals focus, or relies on a screen reader to read a form's error messages hits a wall that a sighted, mouse-using tester never notices.
The city's accessibility office ran a screen-reader and keyboard audit and filed a defect list mapped to WCAG 2.2 AA success criteria. Over the next four steps you'll work through that list component by component, turning each defect into a concrete code fix. Every task in this lab is graded by a check that runs your code and inspects what it returns — the same way an automated accessibility test or a browser's Accessibility pane would inspect a live page. ## The social model, not the medical model
It's tempting to describe accessibility defects as problems with the user — "this resident can't see the button," "that resident can't use a mouse." That's the medical model: it locates the limitation in the person. WCAG, and this lab, work from the social model instead: the limitation is in the design. A button someone can't see is a contrast defect in the design, not a vision defect in the resident. A slider someone can't operate without a mouse is a missing keyboard interface, not a motor defect in the resident.
That framing matters for how you'll read the tasks ahead. You are not adding special-case handling for "accessibility users" — you are fixing the one implementation so it works for everyone who reaches it, whether that's a mouse, a keyboard, or a screen reader doing the reaching. ## How the defect list maps to the steps ahead
The audit groups the portal's defects the way WCAG groups its own success criteria:
- Step 2 — Perceivable. Colour contrast math behind the low-contrast buttons, a div-soup navigation bar with no landmark structure, and a gallery/video with no alt text or captions.
- Step 3 — Operable. An RSVP modal that traps focus in the wrong order, a drag-only availability slider with no keyboard path, and a session timer that logs residents out without warning.
- Step 4 — Understandable. A registration form whose errors never reach assistive tech, a venue picker that navigates the page without asking, and password rules that only appear after rejection.
- Step 5 — Robust / verifiable semantics. A custom control whose accessible name doesn't match what an accessibility tree would report, RSVP confirmations that never reach a screen reader, and the final assembly of every repaired piece into one page.
Each task edits one function in one file, and each fix is something you could re-verify afterwards in Chrome DevTools' Accessibility pane. Start with Step 2.
info> If you get stuck, you can refer to the provided solution code for each task, available in the
solutionfolder. -
Challenge
Repair perceivable content
Perceivable content starts with contrast math
WCAG 2.2 AA requires a contrast ratio of at least 4.5:1 between normal text and its background (3:1 for large text). The portal's buttons were styled by eye, not by that formula, so several fall short even though they look fine to whoever picked the colours. The fix isn't a new colour picked by eye either — it's a correct implementation of the ratio WCAG actually defines, so any future colour choice can be checked against a real number instead of a guess. ## Landmarks turn a page into a map
A sighted user scans a page's layout to find navigation instantly. A screen reader user without landmark structure has to listen to the whole page top to bottom to find the same thing. HTML's semantic landmark elements (nav, main, header) plus a real list structure let a screen reader jump straight to "navigation" and announce it as a list with a known length — turning a page into a map instead of a transcript. ## Alternatives for anything that isn't text
Alt text and captions exist because images and video carry information that a text-based or audio-only assistive technology can't get any other way. Alt text should describe what the image conveys, not name the file; purely decorative images should be silenced with an empty alt so they don't add noise. Video needs captions for the same reason audio description exists for images: the information has to be available through more than one sense.
-
Challenge
Keep interactions operable
Focus order should match visual order
Keyboard operability depends on focus moving in the order a sighted user would read the screen. A modal that jumps around, skips controls, or lets focus escape to the hidden page behind it breaks that expectation and leaves a keyboard-only user lost inside — or outside — the dialog they're trying to use. ## Every pointer interaction needs a keyboard path
WCAG 2.1.1 requires that everything operable with a pointer also be operable with a keyboard. A drag-only slider has no keyboard equivalent at all, which shuts out anyone who can't use a mouse or touchscreen — not just screen reader users, but anyone with a motor impairment or a broken trackpad. Arrow keys, plus Home and End for the extremes, are the expected keyboard vocabulary for anything that behaves like a range. ## Timing limits must be adjustable
WCAG 2.2.1 requires that a time limit can be turned off, adjusted, or extended, unless it's essential. A session that expires silently punishes anyone who reads slowly, uses assistive tech that takes longer to navigate a page, or simply steps away — with no warning and no way to ask for more time before being logged out.
-
Challenge
Make forms understandable
Errors need to be identified, not just shown
WCAG 3.3.1 requires that an input error be identified and described to the user in text. Showing a red border communicates nothing to a screen reader; the error has to be programmatically associated with its field, typically via aria-describedby pointing at an element holding the actual error message, so assistive tech announces both the field and what's wrong with it together. ## Selecting shouldn't mean navigating
WCAG 3.2.2 says changing a setting shouldn't cause an unexpected change of context unless the user is told in advance. A picker that navigates the page the instant an option is highlighted violates that expectation for everyone, but it's especially disorienting for a screen reader user who can't see the page change happening — selection and confirmation need to be two separate, explicit steps. ## Instructions before rejection, not after
WCAG 3.3.2 asks for labels and instructions when input is required. Password rules that only appear after a failed submit force every user into a guess-and-fail loop, and force a screen reader user to hunt for an error that appeared somewhere else on the page. Showing the requirements — and their live status — before submission turns a rejection into guidance.
-
Challenge
Make semantics robust
The accessible name is computed, not written
Every interactive control has a computed accessible name that assistive tech announces, built from a defined precedence: an aria-labelledby reference wins if present, otherwise aria-label, otherwise the control's own visible text. Getting this order wrong — or skipping a source entirely — is why a control can look labelled in the DOM and still announce nothing, or announce the wrong thing, to a screen reader. ## Live regions announce what already happened
An ARIA live region lets assistive tech announce content that changes without a page reload — exactly what an RSVP confirmation is. The politeness level matters as much as the message: polite announcements wait for a pause, assertive ones interrupt immediately, and picking the wrong one either buries an urgent failure or interrupts someone mid-task for a routine success. ## Bringing every repair into one page
Each fix so far lives in its own function, verified in isolation. The portal only becomes accessible once those pieces are actually wired into the page residents load — the repaired navigation reachable as a landmark, the modal's focus trap active only while it's open, and RSVP outcomes actually reaching the live-region announcer instead of being computed and discarded.
-
Challenge
Run the application
Every task is done, and each one was graded the moment you completed it. What you have not done yet is watch the whole application run at once -- which is the only place the pieces you wrote separately become a single working program.
Start the application
Open the Terminal tab and start the dev server:
npm run devIt serves the application on port 5173. Switch to the Web Browser tab to use it: the page is running the functions you implemented in the previous steps, so what you see is your own code rather than a demonstration of it.
Leave the server running while you look around. It reloads on save, so you can change a file and see the result without restarting anything. ### Run the checks yourself
The lab ran each task's test for you as you went, but they are ordinary tests and you can run them whenever you like. The whole suite:
npx --no-install vitest run --reporter=dotOr one task at a time:
bash runTest.sh "task 2.1"Each failure names the task it belongs to, so the output tells you which step to go back to rather than which line to stare at. Two things worth trying before you finish: break something on purpose and watch the matching check fail, then put it back. Knowing what a failure looks like is worth as much as knowing what a pass looks like, and it costs you nothing here.
When you are done, everything you wrote is still in the editor tabs -- the lab is yours to keep reading.
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.