-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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 #14722
Conversation
#14646 (comment) also mentions closing the dropdown by the |
if (!isActive || (isActive && e.keyCode == 27)) { | ||
if (e.which == 27) $parent.find(toggle).trigger('focus') | ||
if ((!isActive && e.keyCode != 27) || (isActive && e.keyCode == 27)) { | ||
if (e.keyCode == 27) $parent.find(toggle).trigger('focus') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why switch to keyCode
from which
? I mean, keyCode
should always be defined on a keydown
event but which
is normalized by jQuery.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i just wanted it to be consistent… seemed ghetto to check for keyCode, then check for which below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
i disagree with closing it with up - try with the actual option input provided http://www.w3schools.com/html/tryit.asp?filename=tryhtml_select2 |
also, native browser space selects in that option as well, so i think space selecting when open makes sense |
Was just mentioning it, though the dropdowns we provide aren't really comparable to select inputs IMO.
Again not really comparable, but also it requires two space hits to select an item: The first one opens the dropdown and the second one selects the first item. |
ah gotcha – i think it's fine for now. However I don't have really strong feels about it. if you want to change it, feel free :) going to merge this for now though |
Escape key should only close Dropdown
fixes #14646