HTML
html/required-select-placeholder
A required single-choice select starts with an empty placeholder option (value=""), so the required check can fail.
moderatestaticfe-forms
Why
A single-choice select always has a selected option; when the first real option is selected by default, required is already satisfied and the form submits whatever was preselected. People who did not notice the field send "Poland" or "Small" without choosing it, and the data is quietly wrong.
Fix
Make the first option a placeholder with an empty value: <option value="">Choose a country</option>. The HTML standard requires it on a required select with one visible row. Keep the label; the placeholder is not a label.
Examples
<!-- bad -->
<select id="country" name="country" required><option value="pl">Poland</option></select>
<!-- good -->
<select id="country" name="country" required><option value="">Choose a country</option><option value="pl">Poland</option></select>Sources
Facts
- Id
html/required-select-placeholder- Severity
- moderate
- Check
- static checked in the source by
audit - Applies to
htmlangularvuesvelteastrojsx- Taught by the skill
fe-formsNative forms and validation- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain html/required-select-placeholder