Should a blank option always be included in <select> inputs?
For example when asking a user what pet they have and it's a required field, a Please select
option is included since the pet is currently unknown:
<select required>
<option value="">Please select</option>
<option value="dog">Dog</option>
<option value="cat">Cat</option>
<option value="hamster">Hamster</option>
</select>
However if we already know the pet since it's been saved previously, and we only want to allow the user to change the required field, when the user returns to the page should we still include the Please select
option?
So in this case, is it better to remove Please select
so they cannot deselect the field:
<select required>
<option value="dog">Dog</option>
<option value="cat" selected>Cat</option>
<option value="hamster">Hamster</option>
</select>
Or keep the Please select
so the dropdown behaves the same as the original one they used to set the value. If they do deselect the field the browser will prompt them to provide an option when the form is submitted.
<select required>
<option value="">Please select</option>
<option value="dog">Dog</option>
<option value="cat" selected>Cat</option>
<option value="hamster">Hamster</option>
</select>
i.e. is it suitable to remove this option on a required <select>
in this way when an option is saved?