Open krisre-sigmabold opened 1 year ago
Are you able to review/merge this PR, @mtriff?
The bugs that this PR fixes have been reported a couple times in the @filamentphp framework too:
Commenting to bump this PR, as these issues are pressing for our use of choices-js too.
bump. This is a problem we also have. Ik hope someone can review this PR
I have same issue.
bump. Same issue. Retagging @mtriff to hopefull review/merge this PR
Guys, @mrtiff hasn't had any GitHub activity since Nov 2022: https://github.com/mtriff. So it's safe to say this package is no longer maintained.
There's a fork that seems to be active: https://github.com/formio/Choices. They've tagged a 10.2.1 version and the last commit was 2 months ago. I'd suggest seeing if they'll accept this PR instead.
I'm not able to fully test this PR against international languages, and there's a minor behavioral change worth explaining:
Previously, with a single select dropdown that has the focus, it would only be opened when a printable character was entered. This actually breaks the ability for the first character to be the result of a compose operation (e.g. à, entered via
OPTION+`
,a
on a mac, orWINKEY+.
,a
on windows)Now, any keypress will open the select. This allows the following/follow-through characters to be received by the newly-opened-and-focused input box. It also supports things like pasting: entering the sequence "command+v" will have the effect "command opens the select, v pastes into it".
There is an additional bug still present that I wasn't able to figure out how to consistently reproduce. Some internal app state gets stuck in an inconsistent state and you're unable to type in the edit box. Clicking to focus it closes the dropdown, and keypresses are swallowed while it's open, but "keypresses that open" it get appended -- though when opening, the input element does not have focus.
Description
On OS X, pressing the command key while a Choices select is focused will add the text "meta". While looking into the details, I found quite a few more errors surrounding the "first keypress" behavior. When a closed single-select is focused, the following things generate incorrect behavior:
This PR fixes the entire category of behavior by better evaluating what counts as a "printable" character.
Related: https://github.com/Choices-js/Choices/pull/1072 https://github.com/Choices-js/Choices/issues/1068
Screenshots (if appropriate)
Example repro case:
Types of changes
Checklist