News for hackers. Stuff that matters.
Re:HTML is the Web by snek on Wednesday June 26, 2019 @11:56AM (#20286191)
Putting a click element on a div is transparent to accessibility systems. And no, it isn't possible to consider an element with an onclick the same as a button, because events bubble, which means the element with the event listener isn't necessarily the element being watched for a click. IIRC there even used to be a "good practice" where people would attach a single click handler at the root and use it to dispatch events based on the `event.target` instead of attaching a separate handler to each target.
Re:HTML is the Web by dsego on Wednesday June 26, 2019 @07:40PM (#20290451)
React does that, they call it synthetic events, but it's hidden from the developer. In jQuery it used to be called event delegation, made it easy to handle events on dynamic elements without the need to constantly attach/detach handlers.