Closing modal window on the ESC button

Closing modal window on the ESC button

It’s time to improve the accessibility of modal dialogs too! Add an event listener that waits when the ESC button is pressed and then runs the same action as the .modal__closeclass:

[code https://github.com/dumkaio/blog/blob/master/closing_modal_window_on_the_esc_button/code.js]

Try it live on this example

It might be interesting for you

Let’s create together

Start a project

Let’s create together

What are your interested in?

Budget

Timeframe

Personal details

Thank you for getting in touch!
We appreciate you contacting us.
We will get back to you shortly.
Dumka
Something went wrong while submitting the form.
Close