randomly crafting little drop-in accessibility snippets... document.querySelector("[role='button']").addEventListener('keyup', function(e) { if (e.keyCode === 32) { e.preventDefault(); http://this.click (); } });
Oh yeah, it’s just nicer and more readable. But if you need ancient browser support then it’s a no-go indeed.
-
-
could go crazy (for no particular gain): if ((event.key === 'Space') || (event.keyCode === 32)) ...

-
actually scrap that, guess i’d need to first check existence of event.key as well at start of that OR chain...
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.