Accessibility
- The label is a
<label for>pointing at the input, so it names the field and a click on it focuses the input. aria-describedbynames the supporting text and the counter while they are shown, merged with ids you set yourself;aria-invalid="true"marks the error state.name,required,readonly,maxlength,pattern,autocomplete,inputmodeandenterkeyhintreach the native input, so native validation, password managers and virtual-keyboard hints work.- The default placeholder, a single space, is invisible and is not a label; a placeholder you pass shows while the field is focused or has no label.
- Icon HTML is inserted as it is: a clickable reveal or clear icon needs its own
role="button",tabindexandaria-label. - The keyboard is the browser's:
Entersubmits the form, except inmultiline.