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

Components: Resolving unintended key events in IME composition #45605

Closed
7 tasks done
t-hamano opened this issue Nov 8, 2022 · 3 comments
Closed
7 tasks done

Components: Resolving unintended key events in IME composition #45605

t-hamano opened this issue Nov 8, 2022 · 3 comments
Assignees
Labels
[Package] Components /packages/components [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.

Comments

@t-hamano
Copy link
Contributor

t-hamano commented Nov 8, 2022

Related to: #45510, #45599

This tracking issue seeks to resolve the problem of events occurring in IME composition mode causing unintended behavior in some components.

What is IME composition ?

One of the input systems in which the IME composition are used is Japanese.

Because of the vast number of characters in the Japanese language ( including Kanji), it is not possible to input characters directly on a standard keyboard. Therefore, after entering "hiragana" characters, we choose which character to convert to and confirm with the Enter key.

  • When you begin typing a character, an underline appears indicating that the expected character has not been finalized.
  • Use the space or up/down keys to move through the list of candidates.
  • Use the 'left' and 'right' keys to move the cursor position.
  • Press the delete or backspace key to delete characters before or after the current cursor position
  • Finally, press the enter key to confirm your input.
  • Press the escape key to hide input candidates or cancel what you are typing.
Screencast
f38e4476faa008f2cac7f10fd13c5f35.mp4

What is the problem if it is IME composition ?

The keyboard operations described above are only for finalizing characters. However, for some components, these keystrokes are monitored and may cause unintended behavior.

What is the cause and solution?

I found the following differences about key events when character input is not finalized.

  • event.code: returns the pressed key itself
  • event.keyCode: returns the immediately preceding key
  • event.key: returns the string Process

Therefore, in components that accept text input and use event.code, I believe it is appropriate to rewrite them using event.key.

@edit: It turns out that simply replacing event.code with event.key is insufficient. As noted in this comment, it would be desirable to add checks for event.isComposing and event.keyCode.

Components to be fixed

After a series of tests, I believe that the following components are causing problems and should be fixed:

The following components may have a lower priority because I believe that there are few cases where text input elements will be placed.

@t-hamano t-hamano added the [Package] Components /packages/components label Nov 8, 2022
@t-hamano t-hamano self-assigned this Nov 8, 2022
@t-hamano t-hamano added the [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues. label Nov 8, 2022
@t-hamano
Copy link
Contributor Author

t-hamano commented Nov 8, 2022

@ciampo @mirka
If there are other issues that need to be addressed, please advise me 🙏

@t-hamano
Copy link
Contributor Author

Update: The ConfirmDialog and Guide components in the task list use Modal components internally, so this was automatically fixed by #46453. I temporarily added input elements to the two components, and IME input works correctly.

648dd5b0b4744b1c6036d0176f5e5065.mp4

@t-hamano
Copy link
Contributor Author

Once #60090 is merged, all IME composition issues in the component package should be resolved. Therefore, I would like to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Projects
None yet
Development

No branches or pull requests

1 participant