← Trail· Lesson 4 of 7
Accessible forms
label, input, button, fieldset, and native HTML validation.
TODO i18n: Full body translation pending. Title and description are localized; the body below remains in Portuguese for now.
Formulários bons começam no HTML — antes de qualquer JavaScript.
Regras de ouro
- Todo controle tem um
<label>associado (for/idou wrapping). - Use o
typecerto:email,tel,url,number. button type="submit"envia;type="button"não.required,minlength,patterndão validação nativa.
fieldset e legend
Agrupe rádios/checkboxes relacionados:
<fieldset>
<legend>Preferência de contato</legend>
...
</fieldset>