Performance: Form structure
MEDIUM IMPACT
Form structure affects page load speed and interaction responsiveness by influencing DOM size and event handling complexity.
<form><label for="name">Name</label><input id="name" type="text"><label for="email">Email</label><input id="email" type="email"><label for="message">Message</label><textarea id="message"></textarea></form>
<form><div><label>Name</label><input type="text"></div><div><label>Email</label><input type="email"></div><div><label>Message</label><textarea></textarea></div></form>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Form with many nested divs and missing label 'for' | High (many nodes) | Multiple reflows on input focus | Higher paint cost due to complex layout | [X] Bad |
| Semantic form with labels linked to inputs and minimal wrappers | Low (few nodes) | Single reflow on input focus | Lower paint cost with simpler layout | [OK] Good |