ARIA basics interview questions — Web Platform accessibility practice
Reviewed by Mark Dickie · Last updated
10 questions on this page you can answer and see marked on the spot. Go to the first one
ARIA (Accessible Rich Internet Applications) is a set of attributes you add to HTML to expose semantics that assistive technologies can read when native HTML elements alone are not enough. For a Web Platform interview focused on ARIA basics, you should know the three categories of ARIA attributes — roles, states, and properties — and the golden rule that no ARIA is better than bad ARIA. Expect questions about when to reach for ARIA versus a native element, how aria-label and aria-labelledby differ, and what aria-hidden does versus CSS display: none.
| Concept | What it means | Common interview angle |
|---|---|---|
| Role | Declares what an element is (e.g. role="navigation") | When to use an explicit role vs a native element |
| State | A changeable condition (e.g. aria-expanded, aria-checked) | How states map to dynamic widgets like accordions |
| Property | A stable characteristic (e.g. aria-label, aria-describedby) | Picking the right naming/describing attribute |
What does an ARIA-basics interview test?
- The first rule of ARIA — can native HTML do it already? If yes, use the native element; ARIA cannot replicate behaviours like focus management that come built in.
- The difference between
roleattributes andaria-*states/properties, and which one you change when a widget updates. - Accessible naming — how
aria-labelledbyreuses visible text,aria-describedbylinks supplementary help text, andaria-labeloverrides the visible name when no on-screen text exists. - Hiding content correctly —
aria-hidden="true"removes an element from the accessibility tree but keeps it visible, whiledisplay: noneandvisibility: hiddenremove it from both. - The naming commandments: never add ARIA roles to elements that already have them natively, and never change a native element's role to something it is not.
How should you prepare for ARIA interview questions?
Skim the WAI-ARIA Authoring Practices so you can cite patterns instead of guessing. Practice labelling interactive widgets like tabs and dialogs, since those come up often. Know that role="button" on a <div> still requires keyboard support — you own the Enter and Space handling that a real <button> gives you for free. Run through the quiz below to check where you stand before the real interview.
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
| Questions | 25 shown · 30 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | True / false, Short answer, Fill in the blank, Multiple choice, Multiple answer |
What you'll review
- aria basics
- accessibility
Practice questions
Try one before you open the answer. Pick an option and press Check; it's marked on the spot.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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 button contains a visible text label (e.g., "Search") and a decorative SVG icon next to the text. You want screen readers to announce only the word "Search" and not the icon. Which ARIA approach correctly hides the decorative icon from the accessibility tree?#
Options
Show answer
Adding aria-hidden="true" to a decorative SVG hides it from the accessibility tree. Screen readers then skip the icon while it remains visible on screen, so only the visible button text such as "Search" is announced. Labels, descriptions, or explicit aria-hidden="false" do not suppress the icon.
aria-hidden="true" removes the element from the accessibility tree, so screen readers skip the icon entirely while it stays visible to sighted users, and the visible text "Search" is still announced normally. Giving the SVG an aria-label adds an accessible name, which makes the icon more prominent to screen readers rather than hiding it. Setting aria-hidden="false" explicitly keeps the element exposed, and pointing aria-describedby at the label only attaches a description to the icon, so the icon is still read.
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.
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.
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.
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).
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.
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.
A web application displays error notifications in a live region. Screen reader users report that critical error messages are sometimes delayed or not announced, because the live region is configured with aria-live="polite", which waits until the screen reader is idle. Which aria-live value should be set instead so that critical errors are announced immediately, even if it interrupts the current announcement? Give the attribute value.#
Show answer
Set aria-live="assertive". Assertive regions are announced as soon as the update occurs, interrupting whatever the screen reader is currently speaking, which suits critical errors that must be heard immediately.
aria-live="assertive" tells assistive technology to announce updates to the region as soon as they occur, interrupting any speech in progress. That is the behaviour needed for critical error messages. aria-live="polite" queues the announcement until the user is idle, which is the cause of the delays. aria-live="off" disables announcements entirely, so it would make the problem worse. text is not a valid aria-live value; it is a role, not a live-region politeness setting.
Consider this HTML:#
Show answer
The accessible name is "Cancel". Step 2B of the accname 1.2 algorithm checks aria-labelledby first; because it references an existing element (#cancelLabel), its text content becomes the name and the algorithm stops, so aria-label ("Save") and the button's own content ("Submit") are never used.
The accname 1.2 algorithm gives aria-labelledby the highest precedence among name sources: when it references existing elements, their text alternatives are concatenated and used as the name, and the computation returns immediately. The referenced span's text is 'Cancel', so that is the accessible name. The aria-label value 'Save' and the button's text content 'Submit' are never consulted because the algorithm short-circuits at the aria-labelledby step.
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.
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.
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.
Given the following HTML, what is the accessible name of the <button> element, per the WAI-ARIA Accessible Name Computation algorithm (AccName 1.2)? Assume a browser that implements the current specification correctly, and that neither referenced <span> carries aria-hidden or hidden.#
Show answer
The accessible name is "Cannot Submit". The algorithm's aria-labelledby step takes precedence over the button's own text content, so "Click Me" is ignored. It then computes the text alternative of each IDREF in the order listed in the attribute value (lbl2, then lbl1), not DOM order, and joins them with a space, giving "Cannot Submit".
The AccName algorithm checks aria-labelledby (step 2B) before native host-language labeling and before name-from-content (step 2F), so the button's own text 'Click Me' is never used. When aria-labelledby holds several IDREFs, the algorithm computes the text alternative of each referenced element and concatenates them with spaces in the order the IDREFs appear in the attribute value, not in DOM order. Because the attribute lists lbl2 before lbl1, the result is 'Cannot Submit'.
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.
Free · the whole bank · 100 marked answers per 30 days · written feedback on the paid plan