React-modal: ESC key doesn't close modal

Created on 4 Apr 2018  Â·  3Comments  Â·  Source: reactjs/react-modal

Summary:

Steps to reproduce:

  1. go to this codepen https://codepen.io/anon/pen/PRdWdB (its in your example docs)
  2. Try to close the modal with the esc key
  3. Won't close

Expected behavior:

Should close

Additional notes:

Any ideas? I have looked thru the source code a bit, but will dig some more after lunch. This breaks accessibility.

Most helpful comment

Hi @shaun-sweet, shouldCloseOnEsc depends on onRequestClose={Function} to handle the close action.

Here is an example of onRequestClose.

All 3 comments

Hi @shaun-sweet, shouldCloseOnEsc depends on onRequestClose={Function} to handle the close action.

Here is an example of onRequestClose.

Awesome! I must have missed that in the docs because I was looking at the source code thinking it shouldn’t work haha.

I’ll check the docs again and perhaps open a PR for a change if it was obvious

Regards,
Shaun Sweet

On Apr 4, 2018 at 18:38,

Hi @shaun-sweet (https://github.com/shaun-sweet), shouldCloseOnEsc depends on onRequestClose={Function} to handles the close action.

Here is an example of onRequestClose (https://codepen.io/claydiffrient/pen/KNjVBx).

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub (https://github.com/reactjs/react-modal/issues/641#issuecomment-378795717), or mute the thread (https://github.com/notifications/unsubscribe-auth/AP_qCPn1BJZRvbfXK3efEm_69BiL9vNlks5tlXWZgaJpZM4THWB0).

Ok, @shaun-sweet. I'm going to close this issue and if you can find this reference, you can reopen or open a new issue to fix it. Thanks.

Was this page helpful?
0 / 5 - 0 ratings