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

Enter should not open the single-select dropdown on MacOS #1246

Open
zoglo opened this issue Dec 23, 2024 · 1 comment
Open

Enter should not open the single-select dropdown on MacOS #1246

zoglo opened this issue Dec 23, 2024 · 1 comment
Labels

Comments

@zoglo
Copy link
Contributor

zoglo commented Dec 23, 2024

Note

This is a cross operation system issue where the intended behavior works differently between two OS

choices.js chose a hybrid windows and mac way and can either be considered a bug or a feature. A possible workaround should
be making it configurable and leaving the normal behavior as is.

Description

Since Keyboard handling got fixed in #1230, I was made aware of this weird behavior from cross-operating-system users.
The current behavior of opening a single-select differs from the native <select> and opening the options.

Proposal

Add a new configuration option to disable the Enter key opening the single-select dropdown
I'd be willing to provide a PR for that @Xon

Windows: The intended behavior of the native <select> element on the Windows OS**

  • Press Up or Down to instantly switch between options (the dropdown will not open)
  • Press Enter to open the dropdown options
  • Press Up or Down to choose the option
  • Press Enter again to select the options

Mac-OS: The intended behavior of the native <select> element on Mac OS

  • (Press Enter to instantly submit the selection)
  • Press Up or Down to open the dropdown options and navigate through them
  • Press Enter to select it

Since the library always handled opening up the dropdown on down and up even on windows, this could stay as is and be seen as an enhancement.

Reproduction and expected behavior

You can simply reproduce it by cross-checking the behavior of normal selects vs. the single-select

  1. Use MacOs or anything not Windows
  2. Press Enter on single-selects
  3. See that the dropdown opens

Expected behavior

The Dropdown on single-selects should not open on Enter on MacOs.

Choices version and bundle

  • Version: v11.0.x

Desktop (please complete the following information):

  • OS: MacOs 15 / Windows 10|11
  • Browser [chrome, safari, firefox]
  • Version [latest versions]
@zoglo zoglo added the bug label Dec 23, 2024
@leofeyer
Copy link

leofeyer commented Dec 23, 2024

I second this. On macOS, Enter means either "select the option" (when the select menu is open) or "submit the selection" (when the select menu is closed). It would be great if Choices behaved the same.

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

No branches or pull requests

2 participants