Performance: Checkboxes and radios
MEDIUM IMPACT
This affects page interactivity speed and rendering performance when many checkboxes or radio buttons are used.
<fieldset class="form-group"> <legend>Select options</legend> <div class="form-check"> <input class="form-check-input" type="checkbox" id="check1"> <label class="form-check-label" for="check1">Option 1</label> </div> <!-- Render only visible or paginated options --> </fieldset>
<div class="form-check"> <input class="form-check-input" type="checkbox" id="check1"> <label class="form-check-label" for="check1">Option 1</label> </div> <!-- repeated 1000 times -->
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| 1000 individual checkboxes rendered at once | High DOM nodes (1000+) | 1000+ reflows | High paint cost | [X] Bad |
| Grouped checkboxes with pagination or lazy rendering | Low DOM nodes (visible only) | Few reflows | Low paint cost | [OK] Good |