HTML semantics and accessibility (WCAG, ARIA) – Front End interview prep

2,606 interview-style multiple-choice questions on HTML semantics and accessibility (WCAG, ARIA), organized by topic: concepts, scenarios, code to read and tradeoffs, each with a short explanation. Learn the 97 key terms with the flashcards first, then test yourself.

Take the practice test · Flashcards · All study tools

What it covers

  1. 1.1 Semantic structure and landmarks
  2. 1.2 Text, links, images and media
  3. 1.3 Forms and validation
  4. 1.4 WCAG principles and conformance
  5. 1.5 Contrast, color and captions
  6. 1.6 ARIA roles, states and properties
  7. 1.7 Keyboard and focus management
  8. 1.8 Accessible widgets and dynamic content
  9. 1.9 Testing, tooling and legal context

Key terms

1.1 Semantic structure and landmarks

Accessibility tree
The browser's parallel tree of roles, names and states that assistive technology reads
Accessible name
The text assistive tech announces for an element
Document outline algorithm
The abandoned HTML5 model that would have reset heading ranks in each section; it was never implemented and has been removed
Form landmark
The landmark a `<form>` exposes when it has an accessible name
hgroup
An element that groups a heading with related subtitle paragraphs so the subtitles are not extra heading ranks
Implicit role
The role an element gets by default from its HTML semantics
Landmark
A region role (banner, navigation, main, contentinfo) users can jump between
Region landmark
A `<section>` (or `role="region"`) with an accessible name
Scoped header or footer
A `<header>` or `<footer>` inside `<article>`, `<aside>`, `<main>`, `<nav>`, or `<section>`, which does not become the banner or contentinfo landmark
Sectioning content
The HTML category of `<article>`, `<aside>`, `<nav>`, and `<section>`, which start new sections in the document
Sectioning root
An element such as `<blockquote>`, `<details>`, `<fieldset>`, `<figure>`, or `<td>` whose inner headings belong to that subtree
Semantic HTML
Markup that describes what content is (nav, main, button) rather than how it looks
Visually hidden
A CSS technique that hides content visually but keeps it in the accessibility tree

1.2 Text, links, images and media

Art direction
Choosing different image crops or compositions by viewport with `<picture>` and `<source media>`
Audio description
Narration of important visual details in a video
Captions
Synchronized text of dialogue plus important sounds
Empty alt
`alt=""` on a decorative or redundant image, which tells assistive technology to skip it
Figure and figcaption
A `<figure>` groups self-contained content with an optional `<figcaption>`; the caption does not replace the image's `alt`
Language of parts
Marking a passage that is in a different language from the rest of the page with a `lang` attribute
Link purpose
What a link does, determinable from its text (and context)
Text alternative
Text that serves the same purpose as non-text content
Transcript
A document of a media file's spoken and often visual content that can be read and searched without starting playback
WebVTT
The timed text format used by HTML `<track>` for captions, subtitles, descriptions, and chapters

1.3 Forms and validation

Accessible authentication
WCAG 2.2 rule against requiring memory or puzzle tests to sign in without help
autocomplete token
A standard value such as `email` or `new-password` that identifies a field's purpose
Constraint validation
The browser's built-in checks (required, type, pattern, min/max) before a form submits
Error identification
WCAG 3.3.1 (A): when an input error is detected, it is described to the user in text
Explicit label
A `<label for>` that points at a control's `id`, rather than wrapping the control
fieldset and legend
HTML grouping for related controls, with the legend as the group's caption
Identify Input Purpose
WCAG 1.3.5 (AA): the purpose of certain personal fields can be programmatically determined
Label in Name
WCAG 2.5.3 (A): the visible label text must be included in the control's accessible name
Redundant entry
WCAG 2.2 rule against asking for the same information twice in a process
ValidityState
The browser object's flags for why a field failed constraint validation, such as `valueMissing` or `typeMismatch`

1.4 WCAG principles and conformance

Accessibility-supported
A way of using a technology that works with users' assistive technologies and accessibility features
Conformance
Meeting every criterion at a level for a full page or complete process
Conformance level
A, AA, or AAA: the set of success criteria a claim must meet in full
Conforming alternate version
A version that meets the claimed level, provides the same information and function, and is reachable through an accessible mechanism
Contrast ratio
Luminance ratio between text and background, from 1:1 to 21:1
Non-interference
Inaccessible or unsupported content must not block users or break the rest of a conforming page
POUR
Perceivable, Operable, Understandable, Robust: the four WCAG principles
Programmatically determined
Information that software can read from markup or data in a way assistive technologies support
Reflow
WCAG 1.4.10: content usable at 320 CSS px without 2-D scrolling
Success criterion
A testable WCAG requirement with a level (A, AA or AAA)
Sufficient technique
A documented, informative way that is known to meet a success criterion
WCAG
Web Content Accessibility Guidelines, the W3C standard for accessible web content

1.5 Contrast, color and captions

Forced colors
OS mode, such as Windows contrast themes, that replaces page colors with a user palette
Images of text
Text rasterized into an image rather than real characters; restricted by 1.4.5 at AA and more strictly by 1.4.9 at AAA
Incidental text
Text that is not meant to be read, such as background signage in a photograph, and is exempt from 1.4.3
Large text
Text at least 18pt (24 CSS px) regular, or 14pt (about 18.7 CSS px) bold, which may use a 3:1 contrast minimum at AA
Non-text contrast
3:1 contrast for UI component boundaries, states and meaningful graphics
Prefers contrast
The CSS `prefers-contrast` media feature (`more`, `less`, `custom`, or `no-preference`) that reflects a user's contrast request
Relative luminance
The sRGB-based brightness of a color, from 0 (black) to 1 (white), used in the WCAG 2 contrast formula
System colors
CSS keywords such as `Canvas` and `CanvasText` that follow the operating-system palette, especially in forced-colors mode
Use of color
WCAG 1.4.1: color can't be the only way to convey information

1.6 ARIA roles, states and properties

Abstract role
A taxonomy-only role such as widget, command, or window that must not be used in content
Accessible description
Supplementary text read after the name and role
APG
ARIA Authoring Practices Guide: reference patterns for widgets
ARIA
Accessible Rich Internet Applications: attributes that add roles, states and properties for assistive tech
aria-current
Indicates the current item within a set, with values page, step, location, date, time, true, or false
aria-expanded
State on a control that shows whether the content it controls is open
First rule of ARIA
Use a native HTML element when it already provides the semantics you need
inert
HTML attribute that disables interaction and hides a subtree from assistive tech
Live region
A region whose changes are announced by screen readers
Name, Role, Value
WCAG 4.1.2: a custom UI component must expose its accessible name, role, and current states or value
Presentational children
Some roles (button, img, checkbox, and others) flatten or hide descendant semantics in the accessibility tree
Required context role
A parent role that certain child roles must be owned by, such as option inside listbox

1.7 Keyboard and focus management

:focus-visible
A CSS pseudo-class that matches when the user agent determines a visible focus indicator should be shown, typically for keyboard focus
:focus-within
A CSS pseudo-class that matches an element that has focus or contains a focused descendant
aria-activedescendant
Points at the active child while DOM focus stays on the container
Bypass Blocks
WCAG 2.4.1 (A): a mechanism to skip repeated blocks of content, such as a skip link or landmarks
Character Key Shortcuts
WCAG 2.1.4 (A): if a shortcut uses only a letter, number, punctuation, or symbol key, users must be able to turn it off, remap it, or have it work only when the component has focus
Focus Not Obscured
WCAG 2.4.11 (AA): when a component receives focus, it is not entirely hidden by author-created content
Focus order
The order elements receive focus when tabbing
Focus trap
Keeping focus inside a modal while it is open
Keyboard trap
Focus that can't leave a component with standard keys
Roving tabindex
One tab stop for a widget; arrow keys move focus among its items by switching tabindex 0 and -1
Skip link
A link at the top of the page that jumps to the main content
tabindex
The HTML attribute that controls whether an element is focusable and its place in the sequential tab order

1.8 Accessible widgets and dynamic content

Accordion
A set of disclosures stacked as headers and panels, with a policy that one or more panels may be open at a time
Combobox
An input with a popup list of suggestions
details and summary
The native HTML disclosure widget: a <details> element whose <summary> is the control that shows or hides the rest of the content
Disclosure
A button that shows and hides content, with aria-expanded
Light dismiss
Closing a non-modal popup when the user clicks outside it, presses Escape, or opens another auto popover
Popover API
HTML attribute for non-modal popups in the top layer with light dismiss
showModal()
The HTMLDialogElement method that opens a modal dialog in the top layer, makes the rest of the page inert, and restores focus to the opener on close
Status Messages
WCAG 4.1.3 (AA): status messages can be presented to assistive technology without moving focus, typically through a live region
Toggletip
A disclosure opened by a button that reveals extra explanation, as opposed to a hover-or-focus tooltip

1.9 Testing, tooling and legal context

Accessibility Insights
Microsoft's accessibility tooling, including FastPass automated and tab-stop checks and a guided manual Assessment
Accessibility overlay
A third-party script claiming to fix accessibility automatically
Accessibility statement
A public page that names the target standard, known issues, and a way to request help or report problems
EN 301 549
The European standard for ICT accessibility, used in EU public procurement, with web requirements mapped to WCAG
European Accessibility Act
EU law requiring accessible products and services from June 28, 2025
Pa11y
An open-source command-line and CI tool that runs automated accessibility checks against a list of URLs
Screen reader
Software that reads the accessibility tree aloud or to braille
Section 508
The US Rehabilitation Act provision requiring federal agencies to buy and build accessible electronic and information technology
VPAT / ACR
Template and report describing a product's conformance to accessibility standards
WCAG-EM
The W3C Website Accessibility Conformance Evaluation Methodology for scoping, sampling and testing a site against WCAG

Sample practice questions

  1. Why is `<button>` preferred over a `<div>` with a click handler for an action control?

    1. It's focusable, works with Enter and Space, and exposes the button role
    2. Search engines ignore click handlers attached to `<div>` elements
    3. It renders faster, because browsers skip layout for buttons
    4. A `<div>` can't receive click events on touch devices

    Answer: A. It's focusable, works with Enter and Space, and exposes the button role Native buttons come with keyboard focus, keyboard activation and the correct accessibility role; a clickable div needs `tabindex`, key handlers and `role="button"` to match.

  2. What does the `alt` attribute on a purely decorative image (a background flourish) ideally contain?

    1. The word "decorative", so users know they can skip it
    2. The image's file name, so screen readers can identify it
    3. An empty string, `alt=""`, so screen readers skip it
    4. Nothing: leave the attribute off the element entirely

    Answer: C. An empty string, `alt=""`, so screen readers skip it An empty alt marks the image as decorative. A missing alt makes many screen readers read the file name instead.

  3. What is the purpose of `<label for="email">` paired with `<input id="email">`?

    1. It shows the label as a tooltip when the user hovers over the field
    2. It names the input for assistive tech and clicking it focuses the input
    3. It submits the form when the user clicks the label
    4. It checks that the input contains a valid email address

    Answer: B. It names the input for assistive tech and clicking it focuses the input The `for`/`id` link sets the accessible name and enlarges the click target. Wrapping the input in the label also works.

  4. What do the four WCAG principles spell, in order?

    1. SAFE: Simple, Accessible, Focusable, Explicit
    2. CARE: Clear, Accessible, Readable, Easy
    3. LEAD: Legible, Equitable, Adaptive, Durable
    4. POUR: Perceivable, Operable, Understandable, Robust

    Answer: D. POUR: Perceivable, Operable, Understandable, Robust Every WCAG success criterion sits under one of the four POUR principles.

  5. Under WCAG 2.x level AA, what is the minimum contrast ratio for normal-size body text?

    1. 2:1
    2. 7:1
    3. 3:1
    4. 4.5:1

    Answer: D. 4.5:1 AA requires 4.5:1 for normal text and 3:1 for large text; 7:1 is the AAA level.

  6. What is the first rule of ARIA use?

    1. If native HTML already has the semantics you need, use it instead
    2. Put an `aria-label` on every link and button on the page
    3. Add an explicit `role` to every element on the page
    4. Only use ARIA together with a framework such as React

    Answer: A. If native HTML already has the semantics you need, use it instead Native elements bring keyboard behavior and semantics; ARIA only changes what is announced, not how things behave.

  7. What is wrong with `tabindex="5"` on a button?

    1. Buttons ignore tabindex, so the attribute does nothing
    2. It removes the button from the tab order completely
    3. Tabindex only accepts the values 0 and 1 on buttons
    4. Positive values jump it ahead of the natural tab order

    Answer: D. Positive values jump it ahead of the natural tab order Use `0` to add an element to the natural order and `-1` to make it focusable only from script; avoid positive values.

  8. Which pair of elements creates a native disclosure widget (show/hide) with no JavaScript?

    1. `<figure>` and `<figcaption>`
    2. `<fieldset>` and `<legend>`
    3. `<dialog>` and `<form>`
    4. `<details>` and `<summary>`

    Answer: D. `<details>` and `<summary>` `<details>` toggles its content when its `<summary>` is activated and exposes the expanded state to assistive tech.

  9. Which conformance level do most laws and procurement policies (for example Section 508 and the EU's EN 301 549) point to?

    1. WCAG level AAA
    2. WCAG level A only
    3. WCAG level AA
    4. WCAG level B

    Answer: C. WCAG level AA AA is the common legal and contractual target; AAA is not required as a whole because some content cannot meet it.

  10. Which element is the right container for the primary content of a page, and how many should be visible at once?

    1. `<body>`, which already counts as the main landmark
    2. `<article>`, one per heading level
    3. `<section>`, with exactly one per page
    4. `<main>`, with only one visible per page

    Answer: D. `<main>`, with only one visible per page `<main>` creates the main landmark so screen-reader users can jump straight to it; the spec allows only one visible `<main>` at a time.

Practice all 2,606 questions

More Front End