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

fix: Add support for adding new entries with IME input #2232

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

Chartman123
Copy link
Collaborator

@Chartman123 Chartman123 commented Jul 1, 2024

This fixes #2220 by checking for isComposing state of the InputEvent

Duplicate code moved to QuestionMixin.js. The code changes allow for adding new entries with IME input, specifically for languages like Japanese or Chinese. This improvement ensures a better user experience when using IME input methods.

@Chartman123 Chartman123 added bug Something isn't working 2. developing Work in progress feature: 📑 form creation labels Jul 1, 2024
@Chartman123 Chartman123 added this to the 4.2.5 milestone Jul 1, 2024
@Chartman123 Chartman123 self-assigned this Jul 1, 2024
@Chartman123 Chartman123 changed the title feat: Add support for adding new entries with IME input fix: Add support for adding new entries with IME input Jul 1, 2024
@Chartman123 Chartman123 force-pushed the fix/ime-inputs branch 2 times, most recently from 6a78935 to cab1f12 Compare July 1, 2024 22:17
@Chartman123
Copy link
Collaborator Author

Chartman123 commented Jul 1, 2024

@susnux any idea why watching isComposing now changes the behaviour from posting the first entered character to now posting an empty option and then trying to update it which then of course fails?

For testing you could try to enter an é or â or something like that...

Update:
I was able to fix that by also checking if target.value !== '' (only needed for Linux/Mac for latin characters with accents: https://www.w3.org/TR/uievents/#keys-dead)

Update 2:
With Chromium based browsers you need to press the space key two times to post the new option for IME languages. The Input event triggered with the first space still has isComposing === true so it looks like the compositionEnd is fired later than in Firefox.

@Chartman123 Chartman123 marked this pull request as ready for review July 2, 2024 16:40
@Chartman123 Chartman123 requested a review from susnux July 2, 2024 16:41
@Chartman123 Chartman123 added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 2, 2024
@susnux
Copy link
Collaborator

susnux commented Jul 7, 2024

@Chartman123 From mdn it seems that the input event is not guaranteed to be fired after composition ended but only on character input.
Meaning probably the best is to listen to input and compositionend:
Add new entry if:

  • input event with isComposing: false
  • compositionend event after an input event with isComposing: true

@Chartman123 Chartman123 force-pushed the fix/ime-inputs branch 3 times, most recently from cacbed8 to a08179b Compare July 15, 2024 08:55
@Chartman123 Chartman123 force-pushed the fix/ime-inputs branch 2 times, most recently from 17ab27d to a69944f Compare July 29, 2024 07:38
Duplicate code moved to `QuestionMixin.js`. The code changes in allow for adding new entries with IME input, specifically for languages like Japanese or Chinese. This improvement ensures a better user experience when using IME input methods.

Signed-off-by: GitHub <[email protected]>
Signed-off-by: Christian Hartmann <[email protected]>
@Chartman123 Chartman123 modified the milestones: 4.2.5, 4.3 Aug 5, 2024
@susnux
Copy link
Collaborator

susnux commented Aug 6, 2024

Seems to work, but i find testing a bit hard

@Chartman123
Copy link
Collaborator Author

Yeah, let's see what our users will say with the next release :)

@Chartman123 Chartman123 merged commit f18c6f3 into main Aug 6, 2024
42 checks passed
@Chartman123 Chartman123 deleted the fix/ime-inputs branch August 6, 2024 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug Something isn't working feature: 📑 form creation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

incompatible to some input method like Japanese or Chinese
2 participants