Accessibility in Angular
Angular's built-in ARIA directives and the CDK's a11y utilities — making a dynamic UI usable without a mouse or without sight.
Accessibility in Angular
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- A component that looks correct visually can still be entirely unusable to someone navigating by keyboard or by screen reader — accessibility problems are mostly invisible to a purely visual review.
- Angular's own ARIA directives bind ARIA attributes the exact same way any other attribute binding works — this isn't a separate system, it's the [attr.] binding you already know, applied to accessibility-specific attributes.
- The CDK's a11y module provides focus-management utilities (trapping focus inside a modal, restoring it afterward) for exactly the interactive patterns that are easy to get visually right and functionally wrong for keyboard and assistive-technology users.
Accessibility bugs don’t show up in a visual review
Every lesson in this roadmap so far has implicitly assumed a sighted user, navigating with a mouse. That assumption is invisible until you deliberately check for it — a component can look pixel-perfect and still be entirely unusable for someone navigating with only a keyboard, or using a screen reader that relies on semantic structure a purely visual implementation never provided. These aren’t edge-case bugs in the sense of being rare; they’re a whole category of correctness that a standard visual code review simply has no way to catch, because the review itself happens by looking at the screen.
ARIA bindings are the attribute binding you already know
<button
[attr.aria-expanded]="isOpen"
[attr.aria-controls]="'menu-' + menuId"
>
Menu
</button>
This is worth being explicit about, because it demystifies something that can
otherwise look like a separate accessibility-specific system: ARIA attributes
are bound exactly the way any attribute is bound — the [attr.] syntax from
several lessons back, applied to attributes whose job is specifically
communicating state and structure to assistive technology rather than
controlling visual appearance. aria-expanded tells a screen reader whether
this button’s associated menu is currently open; aria-controls tells it which
element the button actually controls. Neither has any visual effect at all —
they exist purely for the accessibility tree, the parallel structure assistive
technology actually reads.
Current Angular also ships built-in ARIA directives that go further than raw
attribute binding, generating correct ARIA markup for common patterns directly
— worth knowing these exist specifically so you’re not always hand-rolling raw
[attr.aria-*] bindings for well-established UI patterns that already have a
correct, built-in answer.
The CDK’s a11y module: focus management for interactive patterns
Some accessibility problems aren’t about attributes at all — they’re about
behavior, and focus trapping inside a modal dialog is the clearest example.
Open a modal with a mouse, and nothing about keyboard focus matters to how it
looks or feels. Open the same modal and try tabbing through it with a keyboard,
and without deliberate focus management, Tab can move focus to elements behind
the modal — visually hidden, but still technically focusable — leaving a
keyboard user disoriented, potentially interacting with content they can’t even
see. The Angular CDK’s a11y module provides a FocusTrap utility built
specifically for this: it constrains Tab navigation to stay within the modal
while it’s open, and restores focus to wherever it was before the modal opened,
once it closes.
This category of problem — correct for a mouse, broken for a keyboard — is the recurring shape worth internalizing from this lesson, more than any single attribute or utility: accessibility means genuinely testing the interaction, not just reviewing the appearance.
This lesson’s video covers Angular’s native ARIA directive feature directly, from a creator whose work has appeared throughout this roadmap; the linked “deeper” video, from Chrome’s own developer-relations team, is a longer, broader treatment of accessibility in Angular apps if you want more depth than this lesson’s tighter pick covers.
Check yourself
A custom dropdown component looks and behaves correctly with a mouse. Why might it still fail for a keyboard-only user, and what kind of attribute is usually missing when that happens?
Mouse interaction and keyboard/assistive-technology interaction are genuinely different interfaces to the same component — a `click` handler says nothing about whether the element is focusable, announces its expanded/collapsed state, or responds to arrow keys the way a native `<select>` would. The missing piece is usually an ARIA attribute like `aria-expanded` or `role`, communicating state and structure to assistive technology that a purely visual implementation never had to think about.
Why does focus trapping inside a modal dialog matter for accessibility specifically, rather than being a nice-to-have?
Without it, pressing Tab repeatedly inside an open modal can move keyboard focus to elements behind the modal that are visually hidden or inert — a sighted mouse user never notices this is possible, but a keyboard-only or screen-reader user can end up interacting with content they can't even see, which is disorienting and can make the modal's content functionally unreachable in the correct order.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.