Performance: ARIA attributes in Bootstrap components
ARIA attributes impact accessibility and can slightly affect rendering performance by adding extra DOM attributes.
<button class="btn btn-primary" aria-label="Submit form">Submit</button>
<button class="btn btn-primary" aria-hidden="true">Submit</button>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using correct ARIA attributes | Adds attributes to DOM nodes | 0 | 0 | [OK] Good |
| Incorrect ARIA usage hiding elements | Adds attributes but hides content | 0 | 0 | [!] Warning: Accessibility issue |
| No ARIA attributes | No extra DOM attributes | 0 | 0 | [OK] Good but less accessible |
<button class='btn btn-primary' aria-controls='collapseExample' aria-expanded='false'>Toggle</button>aria-controls to reference the collapsible element and aria-expanded to indicate open/closed state.aria-controls='collapseExample' and aria-expanded='false', which is correct for collapsible control.<div class='alert alert-warning' role='alert' aria-live='assertive'>Warning message!</div>
role='alert' tells assistive technologies this is an important message that should be announced immediately.<button type='button' class='btn btn-primary' data-bs-toggle='modal' data-bs-target='#myModal' aria-expanded='true'>Open Modal</button>
aria-expanded because modals are overlays, not expandable sections.data-bs-toggle='modal' and data-bs-target='#myModal' are correct. aria-label is optional if button text is descriptive. data-bs-target uses ID selector correctly.role='tab' to define their role in the tablist.aria-selected indicates which tab is active, and aria-controls links the tab to its tab panel.Pass the test and this pattern moves unknown