Stop Modal Close on Escape Key Press


Hello I have progressive web app where i need to stop the modal close on escape key. I didn’t find any documentation to turn off this feature. Can somebody please tell me how can i achieve this?

Prevent closing of multiple modal / alert / picker / etc. on Escape key

I’m currently in this situation. Best thing I can think of right now:

  • Assign a class property to whatever the modal.onDidDismiss() returns
  • Do a null/undefined check, and run the same logic you would have done if the modal was dismissed with an intent to cancel the modal

from a UX standpoint, pressing the ESC key usually carries the intent of cancelling whatever process the user is in.

Its late, but I’m passing this on.