Hacker News new | ask | show | jobs
by Benjammer 1560 days ago
You don't even really need to replace the divs, just add tabIndex="0" on the things that should be focusable/tab-able.
1 comments

This is mostly true, but it's usually better/easier to use the semantic element for any particular use case. In this case, for example, to correctly mimic how the <a> tag works, you'll need to handle both click events and keyboard events (e.g. space for clicking), and even then you'll struggle to handle right-clicks, ctrl-clicks or middle clicks in a way that is truly cross-platform.

The <a> tag, on the other hand, just does all that for you.