Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Verify a Component Like Its Users

In this lesson, you checked each line of the borrowing FAQ’s contract in the order its users meet the accordion:

  • Keyboard first. Click the page’s heading so Tab starts below the site links, then press Tab. Focus lands on the first question, with the green ring inside its border. Enter opens it, Tab moves to the next question, and Space opens it and closes it again. That’s a sample. Walk every question the same way, backward with Shift+Tab too, and the contract’s keyboard and focus lines are checked.
  • Then the screen reader’s view, the accessibility tree. In this lesson’s run in Chromium on November 29, 2026, the Accessibility pane gave the first question’s summary the role DisclosureTriangle, the question as its name, and Expanded false. After Space, Expanded turned true, with the answer right after the summary. That checks role, name and states.
  • Then your own screen reader. Turn on VoiceOver with Cmd+F5, according to Apple’s VoiceOver User Guide, or NVDA with Ctrl+Alt+N, as NVDA’s User Guide explains, and listen for the same name and states.
  • Then the automated tools. axe DevTools, the free browser extension, finds no violations on the page as it loads. Every answer is closed then, so that only covers what’s showing. Open each question in turn and run axe again. There are still no violations, so names, headings and the answers’ text contrast all pass.
  • Measure what axe leaves. Scroll so a heading sits under the sticky header, and axe can’t decide that contrast pair. Axe DevTools lists it under Needs Review. Measure it yourself: its text comes to 14.21:1. Axe checks text only, so measure the border too: 4.57:1 on the page’s surface, above the 3:1 it needs. On the answer’s panel, as in the previous lesson, it’s 4.24:1.
  • What the tools can’t see. With outline: none added to the summary’s focus rule in the Styles pane, the ring disappears, and axe still shows no violations, because none of its rules asks whether you can see where focus is. That’s why the keyboard comes first.
  • What Lighthouse leaves to you. Lighthouse’s accessibility audit reloads the page, dropping that edit, and scores it 100, but it still lists ten items under Additional items to manually check, such as a logical tab order. It can’t settle those automatically, so they’re yours.
  • Then the settings people choose. Open the Command Menu with Ctrl+Shift+P, or Cmd+Shift+P on macOS, and run Show Rendering. When you emulate forced colors, the green gives way to system colors, but the border, the marker and the line under the open question all stay. When you emulate reduced motion and open a question, the answer appears at once, because the accordion has no motion. A fail would be an animation that still runs.
  • Light and dark. Emulate a dark color scheme. Kwame’s page now supplies dark values for its tokens in base.css, and the accordion follows them without a rule of its own. Repeat the checks in dark. The ring shows on a closed question and an open one, axe finds no violations with each question open, and the border measures 5.6:1 on the page’s surface.

Verify a component the way its users meet it: keyboard first, then the screen reader, then the automated tools, then the settings people choose. If the tools go first, a clean report feels like the end. Start with the keyboard, and you’ve already checked what they can’t see.

Here are the page’s dark values in base.css, after its :root rule:

Language: CSS
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --color-text: #e4ebe6;
    --color-surface: #161d19;
    --color-accent: #7cc9a0;
    --color-on-accent: #10241a;
    --color-border: #8b968f;
    --color-panel: #22302a;
  }
}

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

00:00 Kwame’s FAQ accordion now has a written contract: nine promises, from its role to what it needs from the page. A promise only counts once someone checks it.

00:12 In this video, you’ll check each line on the borrowing FAQ, in the order its users meet it.

00:19 Start with the keyboard, the way Amara Okafor uses the site. Click the page’s heading so Tab starts below the site links, then press Tab. Focus lands on the first question, ring inside its border.

00:33 Enter opens it. Tab moves to the next question, and Space opens it and closes it again. That’s a sample. Walk every question the same way, backward with Shift+Tab too, and the keyboard and focus lines are checked.

00:50 Next, the screen reader’s view, the accessibility tree. On the first question, the Accessibility pane shows the role DisclosureTriangle, the question as its name, and Expanded false.

01:03 Press Space, and Expanded turns true, with the answer right after the summary. That checks role, name and states.

01:12 Then turn on your own screen reader, with the keys on screen, and listen for the same name and states.

01:20 Now the automated tools. Run axe DevTools, the free browser extension, on the page as it loads. No violations. But every answer is closed, so that only covers what’s showing.

01:34 Open each question in turn and run axe again. Still no violations. Names, headings and the answers’ text contrast all pass.

01:45 Scroll so a heading sits under the sticky header, and axe can’t decide that contrast pair. It lists it under Needs Review instead of passing it. Measure it yourself.

01:55 It’s 14:1. Axe checks text only, so measure the border on the page’s surface too: 4.57:1, above the 3:1 it needs. That covers contrast in the light theme.

02:11 Now try an experiment. In the Styles pane, add outline: none to the summary’s focus rule, and the ring disappears. Does axe report a problem now? Your turn: pause the video and predict.

02:29 No. Axe still shows no violations, because none of its rules asks whether you can see where focus is. That’s why the keyboard comes first. A clean report can’t tell you that someone has lost their place.

02:42 Lighthouse’s accessibility audit reloads the page, dropping that edit, and scores it 100. It still lists ten items to check manually, such as a logical tab order.

02:52 It can’t settle those automatically, so they’re yours.

02:58 Last come the settings people choose. Open the Command Menu with Control+Shift+P, or Command+Shift+P on a Mac, and run Show Rendering. Emulate forced colors.

03:10 The green gives way to system colors, but the border, the marker and the line under the open question all stay. Emulate reduced motion, then open a question.

03:21 The answer appears at once, because the accordion has no motion. A fail would be an animation that still runs.

03:30 Emulate a dark color scheme. Kwame’s page now supplies dark values for its tokens in base.css, and the accordion follows them without a rule of its own. Repeat the checks in dark.

03:43 The ring shows on a closed question and an open one. Axe finds no violations with each question open. The border measures 5.6:1. Kwame writes the result under the contract, with the date, what he checked, and what the accordion needs from the page in every theme.

04:03 Verify a component the way its users meet it. Keyboard first, then the screen reader, then the automated tools, then the settings people choose. If the tools go first, a clean report feels like the end.

04:16 Start with the keyboard, and you’ve already checked what they can’t see. Next, in Exercise: Turn the FAQ Into a Kit Component, you’ll make the borrowing FAQ a component that any page can restyle without touching its rules.

Become a Member to join the conversation.