Our modals always respond to pressing ESC and ENTER (we handle the
keyUp event). The problem is that sometimes some code can handle the
keyDown event (for Ctrl+Enter for example) and close the modal before handling the
keyUp event in the modal. With the current implementation, it leads to one more accepting or dismissing of the modal.
This PR fixes this problem, we’ll be responding to pressing ESC or ENTER only when we’re on the modal.