-
Notifications
You must be signed in to change notification settings - Fork 192
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
What should pressing 'escape' do with the selected value for select? #102
Comments
Testing a little bit further I decided to look at |
It's worth noting, that while this issue is specific to escape, effectively it's about changing the state (or dismissing) the select using a way in which normally isn't identified as a user "selecting" the option. This could be clicking/touching outside the window, clicking cancel, etc. |
The select is very confusing this way. There are differences in behaviour even on the same OS but with different browsers. Most of them have to do with keyboard navigation and/or recognizing the difference between focussing and selecting a value. |
@erikkroes yep, that's what the table shows and what I'm trying for us to get agreement on. I personally find it confusing that moving the arrow key would select something when escape normally means to "cancel". Just to be a bit more thorough and it would be cool if someone can test settings on MacOS, I did the following on Windows:
It reverted to Picture, which aligns with what the majority of libraries do but most browsers do not. |
macOS select controls keep the previously selected option. Both when pressing Esc and when clicking outside the popup. Chrome, Firefox, and Safari all work the same (as the controls inside OS level UIs). Sidenote: that’s how the In my view, the arrow keys and the mouse cursor is changing the focused item, kind of like simulating tab/shift+tab. Another explicit user action is required to actually activate/select the focused option. |
In other contexts the escape key is used to, well, escape something, usually without any consequences (dismissing a dialog for example). That said, when it comes to forms things are much less consistent I think. You can't exit out of a set of radio buttons using escape and have your selection unselected in the process - at least not in Chrome/Firefox on Windows. Although I'm a habitual Firefox on Windows user, and I'm used to the last selected option remaining selected even when escape is used to exit the select, I have to say that this feels like the wrong outcome. Logically escape should let me exit the select without my actions being registered. |
Thanks for the feedback @jouni and @LJWatson - we discussed this in the last telecon and I forgot to post the agreed upon resolution here.
This effectively highlights the functionality that @jouni stated and it brings consistency on the platform. |
The initial rough draft of events tied to parts (they aren't all there) have landed with this PR: #103 This contains the resolution above as the value of select is only updated on invocation of the option not merely changing focus to the option. |
While working on adding in the events for specific parts of the
<select>
I noticed that my assumption of what should occur when pressing escape upon changing an option did not behave that way in Chromium browsers on Windows. So I've put together a very basic repro steps, you can use this fiddle to test it out: https://jsfiddle.net/3uh6nfsr/Keeping with the descriptivism of Open UI I decided to look at other browsers and libraries and the results are actually more diverse than I expected:
So here are the results:
In doing a quicker test of multiple selects this would actually bring consistency as multiple selects usually require another key to select them and thus escape does not set that value since it requires another input from the user.
Based on the above here is my proposed resolution:
The text was updated successfully, but these errors were encountered: