WCAG H32: Providing submit buttons

Rule ID:
wcag/h32
Category:
Accessibility
Standards:
  • WCAG 2.2 (A)
  • WCAG 2.1 (A)
  • WCAG 2.0 (A)

WCAG H32 requires each <form> element to include at least one submit button in order to allow users to interact with the form in a predictable way. For instance pressing enter in an input field to submit.

This rule checks for the presence of:

Submit buttons can either be nested or associated using the form attribute.

Rule details

Examples of incorrect code for this rule:

<form>
    <label>
        Text field: <input type="text">
    </label>
</form>
error: <form> element must have a submit button (wcag/h32) at inline:1:2:
> 1 | <form>
    |  ^^^^
  2 |     <label>
  3 |         Text field: <input type="text">
  4 |     </label>


1 error found.

Examples of correct code for this rule:

<form>
    <label>
        Text field: <input type="text">
    </label>
    <button type="submit">Submit</button>
</form>

Submit buttons may also use the form attribute to associate with a form:

<form id="my-form">
    ...
</form>
<button form="my-form" type="submit">Submit</button>