Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow esc key to hide multiselect options #2135

Closed
jhudson8 opened this issue Feb 14, 2018 · 3 comments · Fixed by #2208
Closed

Allow esc key to hide multiselect options #2135

jhudson8 opened this issue Feb 14, 2018 · 3 comments · Fixed by #2208

Comments

@jhudson8
Copy link

jhudson8 commented Feb 14, 2018

Clicking on a canvas element will not hide the multiselect options. If most of the page is a canvas element this makes things difficult.

It would be great if the esc key would hide the multiselect menu. I think it would be fairly simple (although I haven't been in the code much)

Handle key down event to detect when escape key is clicked
https://github.com/palantir/blueprint/blob/develop/packages/select/src/components/select/multiSelect.tsx#L140

Set state isOpen to false and blur the input field

Thanks

@giladgray
Copy link
Contributor

oh yeah seems it's trying to close on escape (from Popover), but the input focus re-opens it. eas to fix, as you suggested above.

@danielbh
Copy link
Contributor

danielbh commented Feb 28, 2018

This is very straightforward as you said. You can just put a this.input.blur() here. However, I'm having trouble creating test coverage. What I was thinking was just to put a test spy on onBlur, but I'm having trouble accessing the event. What do you recommend?

@giladgray
Copy link
Contributor

@danielbh the select package does not have coverage requirements so don't bother too hard with tests. would love to see your change, please push it up to a branch and set up CircleCI!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants