slim-select: HTML required message doesn't show if no value is selected
Describe the bug E.g. the following select inside a form doesn’t show any kind of error or notice, that a value needs to be selected:
<select required="required" data-validity-message="My custom required message" oninvalid="this.setCustomValidity(''); if (!this.value) this.setCustomValidity(this.dataset.validityMessage)" oninput="this.setCustomValidity('')">
<option value selected>Please select something</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
Recreate it in Codepen https://codepen.io/kevinpfeifer/pen/qBeXqgB
To Reproduce Steps to reproduce the behavior:
- Go to https://codepen.io/kevinpfeifer/pen/qBeXqgB
- Click on
Submit - The message “My custom required message” will pop up over the native select but not the slim select one
- If you select something in the native select the the submit button won’t do anything.
- If you select a value inside both selects then the form submit handler will trigger and show an alert to indicate, that the submit worked.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (11 by maintainers)
Never was a problem. You are the only person who has ever asked for this. This is a you thing only.