Skip to content

Add open on ENTER behavior - #2037

Closed
jasonchangxo wants to merge 1 commit into
JedWatson:masterfrom
jasonchangxo:open-on-enter
Closed

Add open on ENTER behavior#2037
jasonchangxo wants to merge 1 commit into
JedWatson:masterfrom
jasonchangxo:open-on-enter

Conversation

@jasonchangxo

Copy link
Copy Markdown
Contributor

Note: This is my second time contributing to open source so please let me know if there's anything I can fix/change/edit with this PR.

I was working on accessibility/screen reader related issues which requires a lot navigating via keyboard-only. I found that pressing ENTER on the combobox does not open the options, which I believe to be standard expected behavior with dropdowns and comboboxes.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.3%) to 92.056% when pulling 56e5048 on jasonchangxo:open-on-enter into 7523c20 on JedWatson:master.

@JedWatson

Copy link
Copy Markdown
Owner

Thanks @jasonchangxo

The PR itself looks good but I've checked the behaviour of HTML <select> controls in the browser, and enter doesn't actually open / close the menu (I believe it would submit the form if the control is inside one, and there is a type="submit" button... that's another story though)

Spacebar, however, does toggle the menu's open state; so I think it would be a good change to toggle react-select's open state when spacebar is pressed.

Note that we'd only toggle the menu closed when the select is not searchable - you'd need to use enter to select the focused option when the menu is open if the select is searchable.

I'm going to close this PR but please do open a new one with that change if you'd like to contribute it :)

@JedWatson JedWatson closed this Oct 19, 2017
@JedWatson

Copy link
Copy Markdown
Owner

Oh, forgot to mention - you can see the default behaviour by playing with this sandbox: https://codesandbox.io/s/1q14m9wxkj

@JedWatson JedWatson mentioned this pull request Oct 19, 2017
@jasonchangxo

jasonchangxo commented Oct 23, 2017 via email

Copy link
Copy Markdown
Contributor Author

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants