Accessibility Middle cheat sheet: interview answers

Every question of this level with its correct answer and explanation, on one page for a quick review before the interview.

  1. 1. What is the accessibility tree?

    Correct answer: A browser structure of roles, names and states built from the DOM

    Assistive technologies read this tree through platform APIs, not the DOM directly. Chrome and Firefox DevTools let you inspect it for any element.

  2. 2. Which source usually wins when computing an element's accessible name?

    Correct answer: aria-labelledby, then aria-label, then native labelling and content

    The computation has a defined order. aria-labelledby overrides everything, so a stale reference can silently replace a good visible label.

  3. 3. What is the difference between aria-labelledby and aria-describedby?

    Correct answer: The first sets the name; the second adds a supplementary description

    The name says what a control is and is always announced. The description adds details such as format hints, and users can configure whether they hear it.

  4. 4. Why prefer aria-labelledby pointing at visible text over aria-label?

    Correct answer: Visible text stays in sync and is translated with the page

    aria-label is easy to forget during updates and browser translation tools may skip it. Reusing visible text keeps one source of truth.

  5. 5. What is wrong here?

    <div aria-label="Order status">Shipped</div>

    Correct answer: aria-label on a generic div with no role is not reliably exposed

    Naming is prohibited on the generic role, so assistive tech may ignore it. Give the element a suitable role or use real text.

  6. 6. Why is <nav role="navigation"> unnecessary?

    Correct answer: <nav> already has that implicit role

    Native elements have implicit roles, so repeating them adds noise. html-aria lists which roles are allowed on each element.

  7. 7. Why can <button role="link"> be a bad idea?

    Correct answer: It announces a link but behaves like a button

    A role overrides the native semantics without changing behaviour, so users hear one thing and get another. Choose the element that matches the behaviour.

  8. 8. Two <nav> elements on one page: what should you do?

    Correct answer: Give each a distinct name with aria-label

    Screen readers list landmarks, so "Main navigation" and "Footer links" are useful, while two entries called "navigation" are not.

  9. 9. When does a <section> become a landmark?

    Correct answer: When it has an accessible name, as a region

    An unnamed section is ignored as a landmark. Name only significant regions, or the landmark list gets noisy.

  10. 10. How should a field error be linked to its input?

    Correct answer: aria-invalid="true" plus aria-describedby to the message

    The state says the value is invalid and the description says why, so the message is read when the field gets focus. aria-errormessage exists but has weaker support.

  11. 11. Native required or aria-required: which should you prefer?

    Correct answer: required, since it brings both semantics and validation

    required has semantics and validation. aria-required only announces. Using noValidate with required also works for custom error UIs.

  12. 12. After a failed submit of a long form, what's a good pattern?

    Correct answer: Move focus to an error summary with links to the fields

    A summary tells users how many errors exist and takes them there. Focus should move to it so keyboard and screen reader users notice.

  13. 13. Why validate on blur or submit rather than on each keystroke?

    Correct answer: Errors announced mid-typing interrupt and confuse users

    Telling users an email is invalid after the first letter is noise, and worse with a screen reader. Validate when they've finished the field.

  14. 14. What does aria-live="polite" do differently from assertive?

    Correct answer: It waits for a pause instead of interrupting speech

    Use polite for most status updates. assertive interrupts, so keep it for urgent problems like a lost connection.

  15. 15. Why doesn't injecting a new element with role="alert" always get announced?

    Correct answer: Live regions are most reliable when they exist before changing

    Assistive tech has to register the region first. Keep an empty container in the DOM and update its text.

  16. 16. What is the difference between role="status" and role="alert"?

    Correct answer: status is polite; alert is assertive and for important messages

    "3 results found" is a status. "Payment failed" is an alert. Neither moves focus.

  17. 17. Why doesn't a React Router or Next.js page change behave like a full page load for a screen reader?

    Correct answer: No document load happens, so nothing is announced automatically

    Manage it yourself: update the title, move focus to the main heading or announce the change. Next.js has a built-in route announcer.

  18. 18. After client-side navigation, where should focus usually go?

    Correct answer: To the new page's main heading or container

    Otherwise focus stays on a link that may no longer exist, or resets to the body. The heading needs tabindex="-1" to accept focus.

  19. 19. A user deletes a list item and focus was on its Delete button. What should happen?

    Correct answer: Move focus to a nearby item or the list heading

    When the focused element is removed, focus falls back to body, and keyboard users start over. Decide where it goes.

  20. 20. Which keyboard behaviour is expected in a tabs widget (role="tablist")?

    Correct answer: Tab enters the list; arrow keys switch between tabs

    A tablist is one Tab stop, so users can skip it quickly. Arrows move within, and Tab goes on to the panel.

  21. 21. What is roving tabindex?

    Correct answer: Only the active item has tabindex="0"; others have -1

    On arrow keys you swap the values and move focus. Tab then enters the group at the last active item.

  22. 22. When is aria-activedescendant used instead of roving tabindex?

    Correct answer: When DOM focus must stay on one element, like a combobox input

    The input keeps focus so the user can type, and the attribute points to the highlighted option. You also have to scroll and style that option yourself.

  23. 23. Should a site's main navigation use role="menu"?

    Correct answer: No, plain links in nav are better; menus are app-style widgets

    role="menu" promises desktop-style behaviour with arrow keys and hides the fact that items are links. A disclosure button with a list of links suits most sites.

  24. 24. How do you build an accessible dropdown of navigation links?

    Correct answer: A button with aria-expanded that shows a list of links

    This is the disclosure pattern. It works with touch, keyboard and screen readers without any ARIA menu roles.

  25. 25. In an accordion, what should the header contain?

    Correct answer: A button inside a heading, with aria-expanded

    The heading keeps the outline and the button handles interaction. aria-controls can link it to the panel.

  26. 26. Which is true of tooltips?

    Correct answer: They must appear on focus too and hold only non-essential text

    A tooltip is not focusable content. If it contains interactive elements, you need a popover or dialog.

  27. 27. Hover content must meet three conditions under WCAG 1.4.13. Which are they?

    Correct answer: Dismissible, hoverable and persistent

    Esc should close it without moving the pointer, the pointer can move onto it, and it stays until the user is done.

  28. 28. How do you make a toggle button's state available to assistive tech?

    Correct answer: aria-pressed="true" or "false" with a stable label

    Pick one: state with a stable name ("Mute", pressed) or a label that changes ("Mute" to "Unmute"). Doing both reads as "Unmute, pressed".

  29. 29. When should you use role="switch" rather than a checkbox?

    Correct answer: For an on/off setting that takes effect immediately

    A switch communicates on and off rather than checked. Use a native checkbox as a base when you can.

  30. 30. Which attributes does a custom modal need?

    Correct answer: role="dialog", aria-modal="true" and an accessible name

    aria-labelledby usually points to the title. Native <dialog> with showModal() handles most of the rest for you.

  31. 31. What does the inert attribute do?

    Correct answer: Blocks focus and clicks and hides content from assistive tech

    Setting inert on background content is the modern way to keep users in a custom modal. It replaces manual aria-hidden and tabindex juggling.

  32. 32. Why render a custom modal in a React portal?

    Correct answer: It escapes parent stacking and makes the background easy to inert

    Portals only change where the DOM goes. You still have to manage focus, Esc and semantics. Note that React events bubble through the React tree.

  33. 33. A confirm dialog like "Delete project?" should use which role?

    Correct answer: alertdialog, with focus on the least destructive action

    alertdialog signals an interruption that needs a response. Placing initial focus on Cancel avoids accidental deletion.

  34. 34. A sticky header covers the focused element after tabbing. What fixes it?

    Correct answer: scroll-padding-top on the scrolling container

    WCAG 2.2 requires a focused element not to be entirely hidden by author content. Scroll padding keeps it clear of the header.

  35. 35. What contrast does WCAG require for a focus indicator or input border?

    Correct answer: 3:1 against adjacent colours

    Non-text contrast covers UI components and meaningful graphics. An input with a pale grey border may fail even if its text passes.

  36. 36. Do disabled controls have to meet contrast requirements?

    Correct answer: No, inactive components are exempt

    WCAG exempts them, though a very faint button can still confuse users. Consider explaining why the control is unavailable.

  37. 37. What is the difference between disabled and aria-disabled="true"?

    Correct answer: aria-disabled keeps focus and clicks; you must block the action

    A disabled button leaves the Tab order, so users can't discover it. aria-disabled lets them reach it and hear why it's unavailable.

  38. 38. What is forced colors mode?

    Correct answer: The OS replaces page colours with a user-chosen palette

    Windows Contrast Themes use it. Backgrounds and shadows disappear, so a focus ring made with box-shadow vanishes. Prefer outline.

  39. 39. Why is a focus style made only with box-shadow risky?

    Correct answer: It disappears in forced colors mode

    outline survives. A common trick is outline: 2px solid transparent, which becomes visible in forced colors.

  40. 40. What does the media query prefers-contrast: more detect?

    Correct answer: A user request for higher contrast in the system

    Use it to strengthen borders and text colours. It's separate from forced-colors.

  41. 41. What does WCAG 1.4.10 Reflow require?

    Correct answer: Content fits 320 CSS px wide with no two-way scrolling

    That equals 1280px at 400% zoom. Data tables and maps are exempt because they need two dimensions.

  42. 42. What does the Text Spacing criterion test?

    Correct answer: No content is lost when users raise line and letter spacing

    Users may apply their own styles. Fixed-height boxes that clip text are the usual failure.

  43. 43. Why shouldn't a site lock itself to portrait orientation?

    Correct answer: A mounted device may be fixed in one orientation

    People with wheelchair-mounted tablets can't rotate them. Lock only if essential, as in a piano app.

  44. 44. What does the Pointer Cancellation criterion ask for?

    Correct answer: Actions fire on release, so users can slide away to cancel

    Firing on mousedown means an accidental press can't be undone. Native click already fires on release.

  45. 45. A kanban board uses drag and drop. What does WCAG 2.2 require?

    Correct answer: A single-pointer alternative, like "Move to" buttons

    Dragging is hard or impossible for many users. Buttons or a menu also give keyboard users a route, which is a separate requirement.

  46. 46. What does the Redundant Entry criterion aim to prevent?

    Correct answer: Making users re-enter information in the same process

    Pre-fill the shipping address or offer "same as billing". It reduces cognitive load and errors.

  47. 47. Why must a login form allow pasting a password?

    Correct answer: Password managers and copy-paste avoid a memory test

    Accessible Authentication disallows cognitive function tests unless there's an alternative. Blocking paste breaks password managers.

  48. 48. What should a session timeout offer?

    Correct answer: A warning with a way to extend the session

    People may need much longer to complete tasks. WCAG asks you to allow turning off, adjusting or extending limits.

  49. 49. A button shows "Search" but has aria-label="Find products". Why is that a problem?

    Correct answer: Voice control users saying "click Search" won't hit it

    Label in Name requires the accessible name to contain the visible text. Put that text at the start.

  50. 50. How should you mark a French phrase in an English page?

    Correct answer: Wrap it in an element with lang="fr"

    Screen readers switch pronunciation only when told to. This is Language of Parts, at level AA.

  51. 51. How do you expose a meaningful inline SVG to assistive tech?

    Correct answer: role="img" with a <title> or aria-label

    Inline SVGs have no alt. Decorative ones should get aria-hidden="true" so they're skipped.

  52. 52. A photo set via CSS background-image carries meaning. What's the issue?

    Correct answer: There's no text alternative unless you add one

    CSS images don't reach the accessibility tree. Use <img>, or add role="img" with aria-label.

  53. 53. What is a good way to expose a sortable table column?

    Correct answer: A button in the th, with aria-sort on the header

    The button gives keyboard access and the attribute announces the sort direction.

  54. 54. What does the <caption> element give a table?

    Correct answer: An accessible name that describes the table

    Screen readers announce it when entering the table, which helps users decide if it's worth reading.

  55. 55. Why can display: block on a table break accessibility?

    Correct answer: Browsers may drop the table semantics

    Changing display can strip roles, so a responsive table may stop being a table. Add ARIA table roles back, or wrap it in a scrollable region.

  56. 56. A scrollable code block or table isn't reachable by keyboard. What helps?

    Correct answer: tabindex="0" with a name and a suitable role

    Keyboard users need focus to scroll it with arrow keys. Some browsers do this automatically, but not all.

  57. 57. How do you mark up breadcrumbs?

    Correct answer: A named nav with a list, and aria-current on the last item

    A name like "Breadcrumb" separates it from other navigation, and separators should be decorative.

  58. 58. Why can infinite scroll be a barrier?

    Correct answer: The footer becomes unreachable and focus can get lost

    Content keeps pushing the footer away. A "Load more" button gives control, and the Feed pattern describes a keyboard model.

  59. 59. When "Load more" adds items, where should focus go?

    Correct answer: To the first new item, or stay with an announcement

    Users must be able to continue reading from where they were. A polite status like "10 more results" helps.

  60. 60. What does aria-busy="true" signal?

    Correct answer: A region is being updated, so wait with announcements

    It's a hint for live regions and similar content. Support varies, so also use a status message for loading states.

  61. 61. A virtualized list renders only 20 of 10,000 items. What helps screen readers?

    Correct answer: aria-setsize and aria-posinset on the items

    These tell users "item 150 of 10,000" although most items aren't in the DOM. Keyboard focus also has to survive recycling.

  62. 62. Why is an auto-rotating carousel a problem?

    Correct answer: It moves content users are reading, and needs a pause control

    Anything moving for over 5 seconds needs pause, stop or hide. Hovering or focusing should also pause it.

  63. 63. Which is true of accessibility overlay widgets?

    Correct answer: They don't fix the underlying code and can add new problems

    A script can't reliably repair semantics, focus order or alt text. Many screen reader users dislike them.

  64. 64. How do screen readers usually read a web page on desktop?

    Correct answer: In browse mode, using a virtual cursor; focus mode for fields

    In browse mode, keys are shortcuts such as H for headings. In forms, they switch to focus mode so that typing works.

  65. 65. Which browser and screen reader pairs are the common test setup?

    Correct answer: NVDA with Firefox or Chrome, VoiceOver with Safari

    Behaviour depends on the pair, so test the ones your users have. VoiceOver on iOS and TalkBack on Android cover mobile.

  66. 66. How do you run axe in Playwright tests?

    Correct answer: Use @axe-core/playwright to scan the page and assert no violations

    It finds rule-based problems in real pages. You can scan after interactions, for example with a dialog open.

  67. 67. What is a limit of jest-axe in jsdom?

    Correct answer: Without layout, it can't check things such as colour contrast

    jsdom doesn't render CSS. Use a real browser for contrast and focus visibility.

  68. 68. Roughly how much do automated tools catch?

    Correct answer: Only a part of WCAG; manual testing is still needed

    Rules can detect a missing alt but not a misleading one. Automate the cheap checks, then test by hand.

  69. 69. How does useId help in React forms?

    Correct answer: It makes unique, SSR-safe ids for htmlFor and ARIA links

    Reusable components can't hard-code ids, or two instances would clash. Don't use it for list keys.

  70. 70. Why can changing a list key lose keyboard focus?

    Correct answer: React remounts the node, destroying the focused element

    A new key means a new DOM element, so focus falls to body. Keep keys stable.

  71. 71. Why do many teams use headless primitives such as Radix for widgets?

    Correct answer: They provide tested focus and keyboard logic, with your styling

    Combobox and menu behaviour is hard to get right. You still need good labels, contrast and tests.

  72. 72. What is an accessibility statement?

    Correct answer: A public page on conformance, known issues and feedback contacts

    It shows commitment and gives users a way to report problems. EU public bodies must publish one, and the EAA asks service providers for similar information.

  73. 73. Where in the development process is accessibility cheapest to handle?

    Correct answer: Early, in design and components, not in a late audit

    Colour tokens, focus styles and accessible components spread fixes across the product. Retrofitting costs far more.

  74. 74. What does autocomplete="one-time-code" help with?

    Correct answer: Offering an SMS code for filling in, so no retyping

    It reduces memory and typing effort, in line with Accessible Authentication, and mobile keyboards show the code as a suggestion.

  75. 75. Should links that open in a new tab warn users?

    Correct answer: Yes, say so in the link text or with a labelled icon

    A new tab breaks the Back button, which can disorient screen reader and cognitive users. Avoid it when you can, and warn when you can't.