Performance: Form control basics
Form controls affect page load speed and interaction responsiveness because they add DOM nodes and styles that the browser must process.
<input type="text" class="form-control" aria-label="Name">
<input type="text" class="form-control" style="width: 100%; padding: 20px; font-size: 2rem;" aria-label="Name">
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Minimal Bootstrap form-control | Few nodes | 1 reflow on load | Low paint cost | [OK] Good |
| Form-control with large inline styles | Few nodes | Multiple reflows | High paint cost | [X] Bad |
form-control class in Bootstrap?form-controlform-control class is used to style form inputs such as text boxes, textareas, and selects.form-control styles inputs [OK]form-control to style text inputs.form-control correctly.<input type="email" class="form-control" placeholder="Enter email" aria-label="Email address">
form-control, a placeholder, and an ARIA label.form-control class styles the input nicely. The placeholder shows faint text inside the box. The aria-label helps screen readers identify the input as 'Email address'.<input type="text" class="form-control" placeholder="Name" aria-lable="User name">
form-control is spelled correctly. The placeholder is valid. The input type 'text' is supported.aria-lable is misspelled; it should be aria-label.form-select for styling select dropdowns, not form-control.aria-label="Country selector" provides an accessible name. Including a default option like Select country with selected guides users.form-select, has an accessible label, and a default selected option, making it best practice.Pass the test and this pattern moves unknown