Currently disableCloseOnEsc prop, which disables closing the menu on ESC is only checked once, on component mount, and the keyboard action is not updated if you reconsider later.
This PR implements a runtime check of the disableCloseOnEsc prop inside the default onkeydown handler (which is now installed regardless of the initial value of disableCloseOnEsc).
This is useful for example for implementing responsive "sicky" behavior, where on larger screens you want to dynamically open the menu, disable ESC key, overlay and mouse click-off, following a media query event.
Currently
disableCloseOnEsc
prop, which disables closing the menu on ESC is only checked once, on component mount, and the keyboard action is not updated if you reconsider later.This PR implements a runtime check of the
disableCloseOnEsc
prop inside the defaultonkeydown
handler (which is now installed regardless of the initial value ofdisableCloseOnEsc
).This is useful for example for implementing responsive "sicky" behavior, where on larger screens you want to dynamically open the menu, disable ESC key, overlay and mouse click-off, following a media query event.
See discussion in #39
See for example: https://github.com/ivan-aksamentov/example-react-burger-menu-responsive