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:
button
- a generic button.submit
- a submit button.reset
- a button to reset form fields.
Rule details
Examples of incorrect code for this rule:
<button>My Awesome Button</button>
Examples of correct code for this rule:
<button type="button">My Awesome Button</button>
Version history
- 8.3.0 - Rule added.