Buttons need a declared type
When using a
<button> element, the default type is
submit. So, if you’re just going for a toggle button or other interactive functionality,
type="button" should be added.
I was reading through an article in CSS Tricks from last November about HTML/SVG usage, and it notes that in their study of sites in the wild, about 30% of buttons did not have any attribute at all. Hate to admit, I think I've contributed to that figure.
Of additional interest, buttons do not need
role="button" as it is implied. This is according to the HTML specification on buttons, where it notes that ARIA roles that match the implicit role of the element are not recommended. Further reading about this can be found at w3c.github.io/html/dom.html