Performance: Why accessibility is a requirement
Accessibility impacts user experience and interaction speed, affecting how quickly and smoothly users can navigate and use the page.
<button class="btn btn-primary" aria-label="Submit form">Click me</button>
<button class="btn btn-primary">Click me</button>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No accessibility attributes | Minimal | 0 | Minimal | [X] Bad |
| Proper ARIA labels and semantic roles | Minimal | 0 | Minimal | [OK] Good |
aria-label provide screen readers with descriptions.float, text-center, and bg-primary affect layout and style, not accessibility.aria-label attributes on buttons and links -> Option A<button class="btn btn-primary" aria-label="Close"><span aria-hidden="true">×</span></button>
aria-labelaria-label="Close" tells screen readers to announce "Close" for this button.aria-hidden effectaria-hidden="true" on the span hides the times symbol from screen readers.<input type="text" class="form-control" placeholder="Enter name">
<label> or an aria-label, so screen readers can't identify it properly.aria-label or label for screen readers -> Option Daria-labelledby for modal titlearia-hiddenaria-hidden="true" when the modal is hidden prevents screen readers from reading it.role="button" is wrong for modals; relying only on classes misses accessibility needs.aria-labelledby pointing to the modal title and aria-hidden="true" when hidden -> Option BPass the test and this pattern moves unknown