News for hackers. Stuff that matters.
Re:The unreasonable effectiveness of simple HTML by benbristow on Wednesday January 27, 2021 @03:06PM (#25933210)
> Very few people have the skill to turn a div into an effective button, yet over and over I see web sites with rows of buttons which are in fact just divs with javascript behind them.

You can add role="button" and a modern browser will treat it just like a normal button and all the accessibility that comes with it.

Re:The unreasonable effectiveness of simple HTML by darekkay on Wednesday January 27, 2021 @04:08PM (#25933977)
I wish this would be the case. The button will not be focusable, so we need to add tabindex="0". A disabled div with role="button" is not handled as disabled, so we need to take care of that. Keyboard space/enter will not be triggered on "click" event, unlike real buttons, hence excluding keyboard users. You can check my playground [1] - I'm using it to demo why one should prefer native over custom components.

[1] https://darekkay.github.io/presentations/accessible-web/reso...

Re:The unreasonable effectiveness of simple HTML by vxNsr on Wednesday January 27, 2021 @04:27PM (#25934193)
That's kind of missing the point though, most bad browsers the author mentions don't do modern web very well. They're likely using an older renderer and are missing many features.
Re:The unreasonable effectiveness of simple HTML by GrumpyNl on Wednesday January 27, 2021 @04:05PM (#25933940)
its about simple html and older devices, so just plain button will do the job.