News for hackers. Stuff that matters.
Re:The right tag for the job: why you should use semantic HTML by axilmar on Monday June 07, 2021 @05:35AM (#27420657)
Instead of using special tags to convey meaning, couldn't we just use special attributes? say, a div tag with an 'aria-role' attribute set to menu would indicate a menu, a div tag with an 'aria-role' attribute set to 'checkbox' would indicate a checkbox etc.

That would make creation of visual elements more versatile, keep the number of hacks to minimum (like the hidden input trick for checkboxes), and also make ARIA possible.

Re:The right tag for the job: why you should use semantic HTML by extra88 on Monday June 07, 2021 @08:27AM (#27421737)
Adding an ARIA role only adds the role, you'd then have to add more to name the element (in place of the missing <label>), to put the element in the tab order, and JavaScript event listeners to handle keyboard input correctly. Doing all that is more complex than using a style reset on an input element and even if you do it all correctly, it's less robust.