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

Escape key should only close Dropdown #14646

Closed
tonifisler opened this issue Sep 18, 2014 · 7 comments · Fixed by #14722
Closed

Escape key should only close Dropdown #14646

tonifisler opened this issue Sep 18, 2014 · 7 comments · Fixed by #14722

Comments

@tonifisler
Copy link

Currently, if a dropdown element is focused, the escape key opens and closes the list. It should only close it, as accessibility best practices would suggest.

I'd suggest space key to open and escape key to close.

@hnrch02 hnrch02 added the js label Sep 18, 2014
@NYPD
Copy link

NYPD commented Sep 18, 2014

I'm testing this now in Chrome 36 on Windows 7 I can't get the escape key to open the dropdown. However, the space key does open like you suggested already.

@tonifisler
Copy link
Author

Currently testing on Chrome 37 on OS X 10.9. Also tested on IE9 on Windows 7.

http://getbootstrap.com/javascript/#dropdowns

Current behavior

  • space key scrolls the page (as it should do when no dropdown is focused)
  • escape key opens and close
  • down arrow key opens the dropdown too (but no way to close with up arrow key)

Expected behavior

  • space key opens the dropdown
  • escape key closes the dropdown
  • down arrow key switches the focus to the next item
  • up arrow key allows you to go bak to the toggle button.

@hnrch02
Copy link
Collaborator

hnrch02 commented Sep 24, 2014

@fat Do you agree on the the expected behavior that @tonifisler described?

@wangyifu
Copy link

I found a demo on w3school: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_select2 , which has following behaviors:

  • space key opens the dropdown when focused
  • esc key closes the dropdown
  • up and down key switches the focus to next and last item

Also, I made some changes related to these, see demo here: http://jsfiddle.net/wyfisgood/ubf12kx3/

@fat
Copy link
Member

fat commented Oct 3, 2014

Yep i agree

@phanithinks
Copy link

I am getting the same issue in bootstrap version 4.0,0. On Esc key the drop-down opens but the behavior should be to lose the focus of drop-down or close the drop-down if it was open. Is there any fix for it ?

@patrickhlauke
Copy link
Member

Seems this regressed from 3.x to 4.x. opened a fresh issue about it.

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.

8 participants