Rule proposal: buttons should have type specified #823
bbarry
started this conversation in
New Rule Proposals
Replies: 1 comment
-
I've created a PR on this, please check |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We repeatedly are finding that a developer here or there has forgotten to add a
type
attribute to<button>
tags in templates. Doing so causes buttons to trigger form submit events when they complete and happen to have an ancestor element that is a form tag. This may result in unintended code executing when someone presses the button. Additionally a browser or assisting device might choose to trigger the button to activate when a person submits from within a field in the form.Valid code:
invalid:
Beta Was this translation helpful? Give feedback.
All reactions