Periagoge
Concept
3 min readself knowledge

ARIA Roles and Attributes: When and Why AI Cannot Replace Semantic HTML

ARIA roles and attributes are code markers that tell screen readers what parts of a page do—whether it's a button, menu, or alert—and cannot be replaced by AI because they require intentional design decisions by the developer. AI can describe what's visible, but only proper HTML semantic structure reliably communicates function to assistive technology, making accessible code an accessibility tool itself.

Hypatia
Why It Matters

ARIA (Accessible Rich Internet Applications) is a set of attributes you add to HTML to enhance accessibility when semantic HTML isn't sufficient. ARIA lets you define roles, properties, and states for elements that would otherwise be inaccessible—like custom widgets built with JavaScript or dynamic content that updates without page reloads.

The critical principle: ARIA is a supplement, never a replacement. You cannot use ARIA to fix fundamentally inaccessible structures. A <div> styled as a button with role="button" will technically announce as a button to screen readers, but it lacks keyboard accessibility and other built-in functionality of actual <button> elements. This is why accessibility professionals distinguish between 'technically accessible' and 'truly accessible.'

Where AI Struggles with ARIA

AI accessibility checkers can verify that ARIA attributes follow syntax rules—does aria-label have content? Is the role value recognized? But AI struggles with semantic judgment about ARIA appropriateness. Consider this scenario: a developer uses role="navigation" on a sidebar containing only advertisement links. Technically valid ARIA; semantically wrong. Most AI tools will not flag this because their validation focuses on syntax and WCAG2.1 checkbox compliance, not architectural intention.

Another limitation: ARIA cannot convey relationships that semantic HTML expresses naturally. If you need to associate a label with a form field, <label for="fieldID"> is unambiguous and universally supported. The ARIA equivalent—aria-labelledby—requires both elements to have IDs and for developers to maintain these associations manually. AI can verify the IDs exist, but it cannot evaluate whether the label text is actually appropriate for the field, which a properly structured native form would make obvious.

Common ARIA Patterns AI Can Validate

  • Live regions: aria-live="polite" or aria-live="assertive" on elements that update dynamically. AI can verify these exist on dynamically changing content.
  • Hidden content: aria-hidden="true" on decorative elements. AI checkers verify this isn't accidentally applied to meaningful content.
  • Button and tab roles: role="button" or role="tab" paired with proper keyboard handlers. AI can detect the role but cannot verify keyboard implementation.
  • Tree and menu structures: role="treeitem" with aria-expanded and aria-level for complex navigation. AI validates attribute presence but not logical correctness.

The AI Validation Gap

AI accessibility tools are strongest when auditing semantic HTML structure because the meaning is explicit in the code itself. ARIA requires inference about developer intent. If a developer marks every clickable element as role="button", an AI checker cannot determine if this was intentional (custom rich widgets) or careless (actual links misclassified). This is why automated accessibility testing cannot achieve 100% compliance—some judgments require human expertise or user testing with actual assistive technology users.

Leading accessibility practitioners recommend: use semantic HTML first, add ARIA only when semantic HTML cannot express your component's functionality, then conduct manual testing with screen reader users to verify ARIA patterns work as intended. AI can accelerate the first two steps but cannot replace the third.

Try this: Find a complex interactive component on a website you use (like a date picker or dropdown menu). Inspect its HTML source and identify the ARIA attributes. Run it through an AI accessibility checker and note what passes/fails. Then test it manually with NVDA or another free screen reader to see if the actual user experience matches what ARIA claims. This reveals the gap between AI validation and real-world accessibility.

Helpful guides
Hypatia
Daily Life & Decisions
Related Concepts
Peri
Questions about ARIA Roles and Attributes: When and Why AI Cannot Replace Semantic HTML?

Peri can explain this concept, give practical examples, help you decide whether it applies to your situation, or recommend a journey if appropriate.

Ready to work on ARIA Roles and Attributes: When and Why AI Cannot Replace Semantic HTML?

Explore related journeys or tell Peri what you're working through.