jennschiffer / timbles.js

a very simple jQuery plugin for tables, made by the person who literally did not invent tables
MIT License
38 stars 4 forks source link

Redundant attribute role="button" on <button> element #30

Closed edelooff closed 8 years ago

edelooff commented 8 years ago

According to the ARIA usage note in the HTML5 spec

In the majority of cases setting an ARIA role and/or aria-* attribute that matches the default implicit ARIA semantics is unnecessary and not recommended as these properties are already set by the browser.

We shouldn't set the role="button" that is default on button elements.

The default value is mentioned further down on the page linked, but also in the HTML5 spec on Forms (button).

edelooff commented 8 years ago

In the same light, it seems like we should set type="button" given that the default for type is submit. The buttons we generate aren't part of a form, but the table -may- be in a form, and that would cause the form to submit, if I read things right. That would be bad behavior.

edelooff commented 8 years ago

Adding a plain button without any click handlers attached does submit a form in Chrome, but no longer does that as soon as a click handler is attached to it.

However, placing a paginated timblified table inside a form in Firefox does submit the form when pagination buttons are clicked. From what I can tell from the spec this is correct behavior (although arguably unexpected and undesired, possibly why Chrome does not submit). I don't have access to IE here, but it probably exhibits all and none of the behavior depending on the version used :-)