The ESC key does not dismiss/close the modal.

Link to The ESC key does not dismiss/close the modal. copied to clipboard
Rule ID:
modal-no-esc
User Impact:
Minor
WCAG:
2.1.1.a

Rule

Modals or layers that appear should close on ESC.

Background

Some people cannot use a mouse due to vision or motor disabilities. The ARIA design pattern for dialogs recommends that dialogs allow use of the Escape key to dismiss a dialog in addition to a visible element with role button that closes the dialog, such as a close icon or cancel button.

How To Fix

Fix this issue by using JavaScript to ensure that the Escape (esc) key closes a modal without taking any action.

References