HTML & CSS interview question · Most asked
What is ARIA, and what is the first rule of ARIA?
Summary
ARIA (Accessible Rich Internet Applications) attributes add roles, states and properties for assistive technology when HTML can't express something, such as aria-expanded on a custom disclosure or aria-live for announcements. The first rule: don't use ARIA if a native HTML element or attribute already does the job.
Longer Answer
ARIA changes only what assistive technology is told; it adds no behaviour or keyboard support. Wrong ARIA is worse than none (role="button" on a div that can't be focused). Common legitimate uses: aria-label for icon-only buttons, aria-describedby for error messages, aria-current for the active navigation link, aria-live regions.
Key Points
- Roles, states and properties.
- Prefer native HTML.
- ARIA adds no behaviour.
- Bad ARIA is worse than none.
Deep dive: Modern HTML5 in Production: ARIA Done Right (and Wrong)
Explanation
What interviewers look for
Native-first thinking.
Follow-up questions
- What does aria-live do?
- When would you use aria-label?
More most-asked HTML & CSS questions
- Compare localStorage, sessionStorage and cookies.
- What is HTML5, and how is it different from HTML 4?
- What is HTML?
- What is semantic HTML, and why does it matter?
- What is the alt attribute for, and what makes good alt text?
- What input types and validation attributes did HTML5 add?
- What is the difference between script, script async and script defer?
- What does <!DOCTYPE html> do?