Web Platform accessibility interview questions

Reviewed by Mark Dickie · Last updated

11 questions on this page you can answer and see marked on the spot. Go to the first one

Web Platform accessibility is the practice of building web pages and applications that people with disabilities can perceive, operate, and understand. For interviews, you should know the WCAG success criteria at Levels A and AA, how to use semantic HTML elements so screen readers get correct roles and landmarks, and when to add ARIA attributes versus when native elements already cover the job. You also need to be able to explain focus management in single-page apps, keyboard navigation patterns for custom widgets, and how to test with tools like axe-core alongside manual screen reader checks.

What does an accessibility interview test?

Interviewers want to see that you can move beyond checking a box. They look for practical knowledge of the spec, the ability to audit a component for barriers, and awareness of how assistive technology actually consumes the DOM. Expect questions that mix declarative knowledge (what attributes do) with debugging scenarios (why a modal trap breaks or why a button is not announced).

AreaWhat interviewers ask
Semantic HTMLWhy use <button> over <div onclick>; landmark roles from <header>, <main>, <nav>
ARIAThe first rule of ARIA; aria-label vs aria-labelledby vs aria-describedby; live regions
Keyboard accessTab order, tabindex values, roving tabindex for composite widgets
Focus managementWhere focus goes when a dialog opens and closes; inert vs hidden
Color and contrastWCAG 1.4.3 contrast ratios; text sizing and reflow at 320px
FormsAssociating <label> with inputs; error identification and aria-invalid

How should you prepare for accessibility questions?

  1. Read the WCAG 2.2 success criteria and map each one to a concrete code pattern you have written or could write on a whiteboard.
  2. Practice auditing a page with both an automated tool (axe-core or Lighthouse) and a screen reader (NVDA, VoiceOver, or JAWS) so you can talk about the gap between what passes automated checks and what fails for real users.
  3. Build one custom widget — a tabs component or a disclosure accordion — with full keyboard support and ARIA roles, and be ready to walk through every attribute choice.
  4. Study the WAI-ARIA Authoring Practices Guide patterns for common widgets like comboboxes, dialogs, and menu buttons; interviewers frequently pull scenarios from there.
  5. Know the difference between aria-hidden, hidden, and inert, and when each one is correct for removing content from the accessibility tree.

Key facts

  • Tarmac has 30 Web Platform interview questions on this topic, 25 of them on this page, at difficulty 1–5 of 5.
  • Tarmac tracked 394 job postings asking for Web Platform in September 2026.
  • Roles asking for Web Platform advertise a median base salary of US$172,500, across 184 job postings as of September 2026.
  • Tarmac last reviewed these Web Platform interview questions on 13 October 2026.

At a glance

Questions25 shown · 30 in the bank
Difficulty1–5 of 5
FormatsTrue / false, Short answer, Fill in the blank, Multiple choice, Multiple answer

What you'll review

  1. aria basics
  2. accessibility

Practice questions

Try one before you open the answer. Pick an option and press Check; it's marked on the spot.

True or false: setting aria-hidden="true" on an element removes it from the visual rendering of the page, hiding it from sighted users.#

Options

Show answer

Setting aria-hidden="true" does not hide an element visually. It only removes the element from the accessibility tree, so screen readers skip it while sighted users still see it. Visual hiding requires CSS such as display: none or visibility: hidden.

Why:

aria-hidden controls only whether an element is exposed to assistive technologies; it does not change the visual appearance of the page. Content can remain fully visible to sighted users while being hidden from screen readers, and the reverse holds for CSS-based hiding. To visually hide something you need CSS properties like display: none or visibility: hidden, so the statement is false.

A purely decorative <img> conveys no meaningful information. What value should its alt attribute have so that screen readers skip it instead of announcing the file name or URL?#

Show answer

An empty string: alt="". The attribute is present with no text, which tells assistive technology to skip the image.

Why:

WCAG technique H67 specifies that decorative images should have an empty alt attribute so that assistive technology knows to skip them. Omitting the alt attribute entirely can cause some screen readers to fall back to announcing the image's file name or src URL, which is noise rather than information. An empty alt="" is the correct signal that the image is decorative.

Which HTML element provides an accessible name for a form control when its for attribute matches the control's id?#

Show answer

The <label> element. When its for attribute matches a form control's id, the label text is programmatically associated with that control and becomes the control's accessible name.

Why:

The <label> element, when its for attribute matches a form control's id, programmatically associates the label text with that control. This gives the control an accessible name that screen readers announce and also enlarges the clickable hit area, improving both accessibility and usability. <fieldset> groups related controls, <legend> captions a <fieldset>, and <caption> titles a <table>, so none of these name an individual input.

ARIA is a W3C specification whose acronym expands to _____ Rich Internet Applications. Fill in the missing word.#

Show answer

ARIA is a W3C specification whose acronym expands to Accessible Rich Internet Applications. Fill in the missing word.

Why:

ARIA stands for 'Accessible Rich Internet Applications.' It is a set of attributes (roles, states, and properties) defined by the W3C that supplement native HTML to make dynamic content and custom widgets accessible to assistive technologies. The missing word is 'Accessible.'

The ARIA landmark role that identifies the main content area of a web page is role=_____. Fill in the blank with the role value.#

Show answer

The ARIA landmark role that identifies the main content area of a web page is role=**main**. Fill in the blank with the role value.

Why:

The role value main designates the primary content region of a page, the area where the distinctive content lives. Screen-reader users can jump straight to this landmark to bypass navigation and other peripheral content.

What is the first rule of ARIA according to the WAI-ARIA Authoring Practices? Answer in one or two sentences.#

Show answer

If you can use a native HTML element or attribute with the semantics and behavior you need, use it instead of ARIA. For example, use a real <button> rather than a <div> with role=button.

Why:

The first rule of ARIA is: if you can use a native HTML element or attribute that already provides the needed semantics and behavior, use that instead of ARIA. Native elements come with keyboard support, focus management, and role built in, so layering ARIA on top of them is redundant and error-prone.

An icon-only <button> on a page contains an SVG with no visible text. Which attribute should you add to the button so screen-reader users hear a meaningful name for the control?#

Options

Show answer

The aria-label attribute gives an icon-only button an accessible name that screen readers announce. Because the button has no visible text, assistive technology would otherwise read it generically. Attributes like alt, aria-hidden, and role="presentation" do not supply a name for a button.

Why:

The aria-label attribute supplies an accessible name directly on the element. Without visible text content, the button would otherwise be announced generically, with no indication of what it does. The alt attribute is not valid on a button element, so it does not provide a name. aria-hidden="true" removes the control from the accessibility tree entirely, and role="presentation" strips the button role, so neither gives the control a name.

Which statement correctly describes the first rule of ARIA, as published in the WAI-ARIA Authoring Practices?#

Options

Show answer

The first rule of ARIA is to use a native HTML element or attribute whenever it already provides the semantics and behavior you need, and to reach for ARIA only when no native option exists. ARIA conveys accessibility information but does not add behavior or replace proper HTML structure.

Why:

The first rule of ARIA says that if a native HTML element or attribute already has the built-in semantics and behavior you need, you should use it instead of adding ARIA. ARIA is a supplement for cases with no native equivalent, such as custom widgets. The statement about using ARIA only when no native element or attribute provides the needed semantics or behavior is the one that matches this rule. Adding roles to every element does not follow the rule, ARIA does not control styling, and an ARIA role on a div does not add keyboard behavior, so a native button remains the correct choice.

A developer builds a clickable button using <div onclick=...> with no additional ARIA attributes or tabindex. What is the primary accessibility problem?#

Show answer

A plain <div> is not natively focusable, so it is excluded from keyboard tab navigation and cannot be activated with the Enter or Space key. It also has no implicit role, so screen readers do not announce it as a button or interactive control.

Why:

A <div> is not in the default tab order and exposes no role, so assistive technology users who rely on keyboard navigation or screen readers cannot reach or identify it as a control. To make it accessible you would need role=button, tabindex=0, and keyboard event handlers (e.g. keydown for Enter/Space) — or, preferably, just use a native <button> element, which provides all of these by default.

Which combination of attributes and behavior makes a <div> used as a button both keyboard-reachable and announced as a button by assistive technology?#

Options

Show answer

A <div> used as a button needs role="button" so assistive technology announces it as a button, tabindex="0" so it can receive keyboard focus, and a keydown handler for Enter and Space that runs the same action as a click. Together these replicate the behavior a native <button> provides.

Why:

The combination that works is the button role plus tabindex 0 plus a keyboard handler for Enter and Space that runs the same action as a click. The button role tells assistive technology to announce the element as a button; tabindex 0 places it in the sequential tab order so keyboard users can focus it; and the Enter/Space handler replicates the activation a native button gets for free. The alternatives fail for specific reasons: a link role misannounces the element, tabindex -1 removes it from the tab order, aria-hidden hides it from assistive technology entirely, and the presentation role strips its semantics while a click-only handler gives no keyboard access.

To add a non-native element such as a <div> to the natural keyboard tab order, set the tabindex attribute to _____. To remove a natively focusable element from the Tab-key sequence while still allowing it to be focused programmatically with .focus(), set the tabindex attribute to _____.#

Show answer

To add a non-native element such as a <div> to the natural keyboard tab order, set the tabindex attribute to 0. To remove a natively focusable element from the Tab-key sequence while still allowing it to be focused programmatically with .focus(), set the tabindex attribute to -1.

Why:

A tabindex of 0 places the element at its DOM position in the sequential Tab-key order, which is how a non-native element such as a <div> joins the natural tab order. A tabindex of -1 removes the element from sequential keyboard navigation but keeps it focusable by script via .focus(), which is useful for skip-link targets and dynamically managed focus.

True or false: adding role="button" to a plain <div> automatically makes it keyboard-accessible, so a user can activate it with the Enter or Space key without any additional JavaScript.#

Options

Show answer

The statement is false: adding role="button" to a <div> only changes how assistive technologies announce the element. It does not make the element focusable or make it respond to Enter or Space. Developers must add tabindex="0" and keyboard event handlers, or use a native <button> element instead.

Why:

This is false. ARIA roles only change the semantics exposed to assistive technologies; they add no behavior. A <div> with role="button" is still not focusable by default and does not respond to keyboard events. To make it keyboard-accessible, a developer must add tabindex="0" for focus and JavaScript handlers for Enter and Space. A native <button> provides all of this without extra code.

What is the effect of setting aria-hidden="true" on an HTML element? Describe what changes for assistive technologies.#

Show answer

It removes the element and all of its descendants from the accessibility tree, so screen readers and other assistive technologies no longer expose them. It does not change the element's visual appearance or its behavior.

Why:

aria-hidden="true" removes the element and all of its descendants from the accessibility tree, so screen readers and other assistive technologies do not announce them. It has no effect on visual rendering or on the element's behavior; it only changes what assistive technologies perceive. Because it does not stop keyboard focus, applying it to a focusable element is an anti-pattern: a keyboard user can still tab to an element that screen readers no longer announce.

When using the aria-live attribute, the value polite tells screen readers to announce content updates only after the user becomes _____, without interrupting their current activity. The value _____ instead causes updates to be announced immediately, even if it interrupts what the user is doing.#

Show answer

When using the aria-live attribute, the value polite tells screen readers to announce content updates only after the user becomes idle, without interrupting their current activity. The value **assertive** instead causes updates to be announced immediately, even if it interrupts what the user is doing.

Why:

The aria-live attribute controls how screen readers announce dynamic content changes. polite means the assistive technology may announce updates but should not interrupt the user; it waits until the user is idle. assertive means the assistive technology should announce updates immediately, potentially interrupting the user's current interaction.

A web form shows validation errors (for example, 'Email address is required') in a <div> that is already present in the page. After submission, the text of that <div> is replaced. The team wants screen reader users to be notified of the new error immediately, interrupting whatever the screen reader is currently announcing. Which attribute and value should be set on that <div>?#

Options

Show answer

Set aria-live="assertive" on the container that displays the error message. Assertive live regions tell screen readers to announce changed text immediately, interrupting current speech. A polite value waits until the user is idle, while aria-busy and aria-hidden do not produce an announcement.

Why:

The keyed answer is aria-live="assertive". An ARIA live region announces content changes to assistive technology, and the aria-live value sets the priority: assertive announces the change immediately and interrupts current speech. The polite value queues the announcement until the screen reader is idle, so it does not meet the requirement of interrupting. aria-busy="true" signals that a region is being updated and asks assistive technology to wait, which is the opposite of an immediate announcement. aria-hidden="true" removes content from the accessibility tree entirely, so the error would never be read. The error container should already exist in the DOM when the message text changes, since live regions are most reliably announced when their content is updated rather than when the region itself is inserted.

Which statements about ARIA are correct?#

Options

Pick every one that applies.

Show answer

Three statements are correct: prefer a native element like <button> over <div role="button"> when one exists, aria-label provides an accessible name when there's no visible text, and aria-hidden="true" removes an element from the accessibility tree. The false one is that ARIA makes a widget keyboard-operable — ARIA only changes semantics, so keyboard handling must still be coded in JavaScript.

Why:

The first rule of ARIA is to use native semantics where possible; aria-label supplies an accessible name; aria-hidden="true" hides a node from assistive tech. ARIA only changes semantics — it adds no behavior, so keyboard handling (focus, Enter/Space, arrow keys) must still be implemented in JavaScript.

The HTML specification recommends marking a purely decorative <img> (one that conveys no meaningful content) with alt=''. If the alt attribute is omitted entirely from an <img> instead, which of the following may happen?#

Options

Show answer

Assistive technology may announce the image's file name or source URL. When an <img> omits the alt attribute entirely, it has no explicit text alternative and is not marked decorative. Screen readers may then fall back to the src value, which is why alt='' is the recommended choice for decorative images.

Why:

When alt is omitted entirely, the image has no explicit text alternative, so it does not get the decorative signal that alt='' provides. Many screen readers then fall back to the src value (the file name or URL) as a last-resort name, which is why that announcement may occur. The option stating that the browser assigns role="presentation" is wrong because browsers do not do that for images missing alt. The option claiming the image is not rendered is wrong because a missing alt has no effect on rendering. The option claiming the image is skipped just as with an empty alt is wrong because an empty alt is the explicit decorative signal, and omitting the attribute is not equivalent to it.

The following HTML and JavaScript create a custom toggle button. The element is reachable with the Tab key, but keyboard users cannot activate it. Which option identifies the accessibility bug?#

Options

Show answer

The missing keyboard handler is the bug. A <div> with role='button' and tabindex='0' can receive focus, but it does not fire click on Enter or Space the way a native <button> does. Keyboard users must get a keydown handler for Enter and Space that runs the same toggle logic.

Why:

A native <button> fires a click event when the user presses Enter or Space, but a <div> does not. This code gives the div role='button' and tabindex='0', so it gets focus, yet its only activation path is the click listener. Keyboard users who press Enter or Space therefore never run the toggle logic. The fix is a keydown handler that calls the same toggle function for Enter and Space. The aria-pressed attribute is valid on the button role, tabindex='0' correctly makes the element focusable, and a div can receive click events from mouse and touch input, so the missing keyboard handling is the bug.

The code below builds a custom toggle button from a <div>. The element is focusable via Tab but cannot be activated with the keyboard.#

Show answer

The bug is the absence of a keyboard event handler. The element has tabindex="0" so it receives focus, and role="button" and aria-pressed are set, but the only listener is a click handler. A native <button> fires click when Enter or Space is pressed, but a <div> does not, so pressing those keys does nothing. A keydown listener must be added that checks for the Enter or Space key (e.key === 'Enter' || e.key === ' '), prevents the default action for Space so the page does not scroll, and then toggles aria-pressed and the underlying state (for example by calling btn.click() or by sharing the same toggle function).

Why:

A native <button> converts Enter and Space key presses into a click event automatically, but a <div> with role="button" does not. In the given code the element is focusable (tabindex="0") and carries the correct ARIA attributes, so the sole defect is that no keyboard listener exists. Only the click handler is registered, so keyboard users can reach the control but cannot operate it. Adding a keydown (or keyup) handler that responds to Enter and Space and toggles the state fixes the behaviour.

The code below builds a custom toggle button from a <div>. It has role='button', tabindex='0', and a click listener that toggles a visual CSS class. A keydown listener calls click() on Enter or Space.#

Options

Show answer

A custom toggle button whose click handler never updates aria-pressed hides its on or off state from screen reader users. Focus and keyboard activation can work correctly, yet the state is still not announced. The fix is to set aria-pressed to 'true' or 'false' in the handler to match the visual state.

Why:

The element is focusable because tabindex='0' places it in the tab order, and the keydown listener explicitly calls the click handler on Enter and Space, so keyboard activation works. The role='button' attribute only changes how the element is exposed to assistive technology; it does not add any keyboard or click behavior by itself, so the explicit keydown code is what makes keyboard use possible. The real defect is that the click handler only toggles a visual CSS class and never sets aria-pressed to 'true' or 'false'. Screen readers rely on that attribute to announce a toggle button's on or off state, so the state change is never communicated. The fix is to update aria-pressed inside the handler to mirror the visual state.

You have a visible, natively focusable element, such as <a href="/docs">Docs</a>, and you add aria-hidden="true" to it. Per the W3C WAI-ARIA specification, what happens to the element in the accessibility tree and to its keyboard focusability? Explain why the result is a problem and how you would fix it.#

Show answer

Per the WAI-ARIA spec, aria-hidden="true" removes the element (and its descendants) from the accessibility tree, so screen readers and other assistive technologies no longer perceive or announce it. It does not change the element's tab order or focusability: an <a> with an href is still focusable and can be reached with Tab and activated. This leaves a focusable control that keyboard users can reach but screen-reader users cannot perceive. The fix is to remove aria-hidden (using visually-hidden CSS if the control must stay perceivable), or to also make the element non-focusable, for example with tabindex="-1" on a single element or the inert attribute on a whole subtree, which makes the content both non-focusable and non-perceivable.

Why:

aria-hidden is a semantic signal only: per the WAI-ARIA spec it removes the element and its subtree from the accessibility tree, but it does not alter focus or tab order. An anchor with an href is focusable by default in HTML, so it stays reachable by keyboard while being invisible to assistive technology. The remedy is either to drop aria-hidden (keeping the control perceivable, e.g. with visually-hidden styling) or to also remove it from the tab sequence with tabindex="-1" for one element or the inert attribute for a subtree.

Consider this HTML: <button aria-labelledby="lbl" aria-label="Cancel">Submit</button> and, elsewhere in the same document, <span id="lbl">Save <strong>changes</strong></span>. Assume no other ARIA attributes, no title attributes, and no other elements or IDs exist in the DOM. What is the accessible name of the <button> as computed by the W3C Accessible Name and Description Computation (ACCNAME) algorithm? Name the algorithm step that decides it.#

Show answer

The accessible name is "Save changes". The button has aria-labelledby pointing at the span with id lbl, which is step 2B of the ACCNAME algorithm and takes precedence over aria-label and the button's own text content. The span's text alternative is computed from its descendant text, "Save " plus "changes" from the strong element, giving "Save changes". The text "Submit" and the value "Cancel" are both ignored.

Why:

Per the ACCNAME algorithm, the accessible name is decided in priority order. Step 2B (aria-labelledby) runs before step 2C (aria-label) and before the element's own text content (step 2F), so the button's name comes from the referenced element. The span with id lbl is named by computing its text alternative from its content, which includes the text node "Save " and the strong element's text "changes", yielding "Save changes". The button's text "Submit" and its aria-label "Cancel" are overridden and do not contribute to the name.

Given the following HTML, what accessible name will assistive technology announce for the <button> element? Both aria-label and aria-labelledby are present, and one of the aria-labelledby targets has aria-hidden set to true on it. According to the W3C Accessible Name and Description Computation, what is the result? ```html <button id=#

Options

Show answer

The accessible name is "Purchase completed". In the W3C Accessible Name and Description Computation, aria-labelledby has the highest precedence, overriding both aria-label and the element's own text content. Additionally, aria-hidden on an element referenced by aria-labelledby does not prevent it from contributing to the name — the spec explicitly allows traversing hidden elements when they are aria-labelledby or aria-describedby targets.

Why:

In the W3C Accessible Name and Description Computation, aria-labelledby has the highest precedence. When it yields a non-empty name, the algorithm returns immediately and neither aria-label nor the element's own text content is considered. Multiple aria-labelledby IDs are concatenated in listed order, giving 'Purchase completed'. Critically, aria-hidden on lbl1 does not block its text from being used: the spec explicitly provides that elements in the aria-labelledby or aria-describedby chain are still traversed for name computation even when hidden. aria-hidden controls whether an element is exposed in the accessibility tree on its own, not whether it can contribute to another element's name via a label reference. The text-content answer (Buy now) is wrong because text content is only consulted when neither aria-labelledby nor aria-label produces a name. The aria-label answer (Submit form) is wrong because aria-label is outranked by aria-labelledby. The concatenation answer (Buy now Purchase completed) is wrong because aria-labelledby replaces, not supplements, the text content when it resolves.

An off-screen overlay is hidden with aria-hidden='true' on its outermost container. Inside that container is a standard anchor element with a valid href attribute. What problem does this create for assistive technology users, and what is the recommended fix?#

Show answer

aria-hidden='true' removes the container and all its descendants from the accessibility tree, so screen readers do not announce the anchor. aria-hidden does not change keyboard focus, and a native anchor with an href is focusable by default, so a keyboard-only user can Tab onto a link that has no name, role, or announcement. This is an invisible focus target that violates WCAG 2.1 SC 4.1.2 (Name, Role, Value). The fix is to avoid applying aria-hidden to any ancestor of focusable content. If the overlay is closed or hidden, remove it from both the accessibility tree and the tab order with the hidden attribute or inert, or remove it from the DOM. If it must stay visible to keyboard users, remove aria-hidden so the anchor is exposed to assistive technology. Setting tabindex='-1' alone only stops Tab from reaching the link and does not fix the hidden-but-focusable mismatch.

Why:

aria-hidden removes an element and its descendants from the accessibility tree but has no effect on keyboard focus. A native anchor with an href remains focusable, so keyboard users can land on a control that screen readers cannot name or announce, which violates WCAG 2.1 SC 4.1.2. The correct fix is to remove aria-hidden from any ancestor of focusable content, or to take the hidden overlay out of both the accessibility tree and the tab order (for example with the hidden attribute, inert, or DOM removal). tabindex='-1' only prevents Tab focus and leaves the mismatch in place for other focus routes, so it is not the primary fix.

Consider the HTML fragment <div><button aria-pressed="true">Toggle</button></div>, rendered normally, with the button focusable and not hidden from assistive technology. Its ancestors contain no roles or attributes that change its role or suppress its children, and no other ARIA state is set on it. Under the WAI-ARIA and Core Accessibility API Mappings rules, what value does the pressed state have for the button in the accessibility tree? And what would that state be if the aria-pressed attribute were removed entirely?#

Show answer

The pressed state is true, because aria-pressed="true" maps directly to pressed=true and the button is exposed as a toggle button. If the aria-pressed attribute were absent, the button would not be a toggle button and the pressed state would be absent (undefined), so no pressed state is exposed to assistive technology.

Why:

The button has the default role button, and aria-pressed="true" is mapped by the Core Accessibility API Mappings to the pressed state with value true, so the button is exposed as a toggle button in the pressed position. The aria-pressed attribute has no default value; when it is absent, the button is not a toggle button and no pressed state is exposed in the accessibility tree. This is different from aria-pressed="false", which still exposes a toggle button in the unpressed position.

Sources

The official documentation these questions are checked against:

Related interview questions

Job market

See web-platform salaries and hiring demand from live job postings.

The other 5 questions

This page shows 25 and marks what you pick. That's as far as a page can go. A free account opens the other 5 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.

Start with this topic

Free · the whole bank · 100 marked answers per 30 days · written feedback on the paid plan

Interview booked? Practise the job ad instead

What moved, monthly

One email a month when the bulletin comes out: what moved in the markets we track, and the new question topics we published. Confirm your address to join. Unsubscribe any time.