Skip to content
RED SAGSkills
easyFrontend Developer interview question

How do you make a form accessible?

What the interviewer wants to hear

  • Every input has a visible label linked with for and id
  • Use the correct native input types and elements, and group related fields with fieldset and legend
  • Show errors in text, link them to fields with aria-describedby and set aria-invalid
  • The whole form works with a keyboard and has a logical focus order
  • Do not rely on placeholder or colour alone to convey meaning

Model answer

I start with native HTML. Every field gets a visible label connected with for and id, because placeholders disappear when people type and are not reliable labels. I use the right input types such as email, tel and number, which also give mobile users the right keyboard, plus autocomplete attributes so browsers can fill details. Related options like radio buttons go inside a fieldset with a legend. For validation, I show the error as text next to the field, connect it with aria-describedby, set aria-invalid on the input, and on submit I move focus to the first invalid field or an error summary. I never use colour alone to show an error. I make sure everything works with the keyboard, the tab order follows the visual order, and the submit is a real button. Finally I test with a screen reader and with keyboard only, and run an automated check such as axe.

Can you answer it under time pressure?

Take a timed easy round and get scored on every answer.

Start mock interview

More easy Frontend Developer questions