Disallow implicit button type

Rule ID:
no-implicit-button-type
Category:
Accessibility
Standards:
-

When the type attribute is omitted it defaults to submit. Submit buttons are triggered when a keyboard user presses Enter.

As this may or may not be inteded this rule enforces that the type attribute be explicitly set to one of the valid types:

Rule details

Examples of incorrect code for this rule:

<button>My Awesome Button</button>
error: <button> is missing recommended "type" attribute (no-implicit-button-type) at inline:1:2:
> 1 | <button>My Awesome Button</button>
    |  ^^^^^^


1 error found.

Examples of correct code for this rule:

<button type="button">My Awesome Button</button>

Version history