I have a lightning component where a popup opens up on certain instruction. now i want to close this popup when even Esc button on keypad is hit.enter image description here

1 Answer 1


As far as I am concerned, the easiest way would be to use the lightning:overlayLibrary component in order to achieve what you are looking for. This component supports Out of the box closing when hitting the ESC key or pressing the cancel button.

Pressing the Escape key or clicking the close button closes the modal.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .