The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Accessible Button Events

Accessible Button Events

6:57
Often buttons need to be handled by JavaScript, and if done improperly it can lead to accessibility issues. In this lesson you will improve a major news organization's global header with some basic HTML and JavaScript.
Watch this lesson now
Avatar
egghead.io

Often buttons need to be handled by JavaScript, and if done improperly it can lead to accessibility issues. In this lesson you will improve a major news organization's global header with some basic HTML and JavaScript.

Avatar
Kent C.

It's notable that you'll also want to check for which key triggered the keydown. Without doing this, you'll trigger your button when any key is pressed (like a). I've updated the example to demonstrate this: jsbin.com/ramoy/edit. Thanks for the lesson Marcy!

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?