3 ms·
Whats missing is which ones work without JavaScript. And accessibility characteristics.
by corty 5y ago
Whats missing is which ones work without JavaScript. And accessibility characteristics.
- FriedrichN 5y agoTrue, only <button> (if type is not "button") and <input type="button"> function within a <form> context as a button.
- extra88 5y ago<input type="image"> does as well.
- amichal 5y agowithout javascript the only meaningful thing that can be done in HTML are to navigate to a new document with HTTP GET (A[href=]) or submit data via HTTP POST or similar verbs ((BUTTON, INPUT[TYPE=BUTTON]. INPUT[TYPE=IMAGE]) where the url is in the FORM tag or the form* attributes. This is because without javascript there are no persistent stores on the client side and you have to interact with HTTP to create a stateful application.
- soperj 5y agoHonestly, most people do not care whether you're doing client side or server side. Regular people don't even notice a difference.
- riffraff 5y agoyeah, "A focusable div with a button role" should be pretty accessible compared to a div with onclick event and neither of those things, for example.
- extra88 5y agoIt is not sufficiently accessible because it still won't activate on Space Bar or Enter/Return keydown events. "Accessible" does not only mean "screen reader users can use it."
- riffraff 5y agomy point is that it's better then a div without those attributes. Switching markup completely is a larger effort than adding tabindex and role and the latter still provides a benefit.
- extra88 5y agoI'd say whether a button does something without JavaScript is a separate topic. The page repeatedly mentions accessibility characteristics, it just doesn't call them all out as such. > Not keyboard focusable > Correct button role > correct key events by default > No accessible name "Shows wrong cursor on hover" is arguably also about an accessibility characteristic.