Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Make menu closable with escape key #75

Merged
merged 2 commits into from
Feb 14, 2017
Merged

Conversation

AriTheElk
Copy link

Status

Ready

Description

Allows the context menu to be closed by pressing the escape key. I think this is expected behavior with a context menu and would be a good addition to the library.

@vkbansal
Copy link
Owner

Thanks for your contribution. This indeed is a nice contribution. Please see my comments

@@ -64,6 +64,7 @@ export default class ContextMenu extends Component {
document.addEventListener('ontouchstart', this.handleOutsideClick);
document.addEventListener('scroll', this.handleHide);
document.addEventListener('contextmenu', this.handleHide);
document.addEventListener('keyup', this.handleEscape);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also remove the event listener in unregisterHandlers

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

@vkbansal vkbansal merged commit e711891 into vkbansal:master Feb 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants