fix: ignore IME composition Enter in rename and project dialogs#8359
Closed
greymoth-jp wants to merge 1 commit into
Closed
fix: ignore IME composition Enter in rename and project dialogs#8359greymoth-jp wants to merge 1 commit into
greymoth-jp wants to merge 1 commit into
Conversation
ChatInput already ignores the Enter that confirms an IME (CJK) composition candidate (janhq#6109), via `e.nativeEvent.isComposing || e.keyCode === 229`. The rename-thread and add-project dialogs listen for that same Enter to submit, so a Japanese/Chinese user confirming a candidate prematurely renames the thread or creates the project. Apply the same guard to both handlers.
Contributor
Author
|
Closing this to clean up my open PRs. It's a small change and not really worth taking up your review time. Sorry for the noise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When an IME (Input Method Editor) user types Chinese or Japanese, they press Enter to confirm a composition candidate. Two dialogs treat that Enter as a submit:
RenameThreadDialog: the confirming Enter renames the thread, so it can fire before the title is finished.AddProjectDialog: the confirming Enter creates the project the same way.ChatInputalready fixed exactly this in #6109 by ignoring Enter whilee.nativeEvent.isComposing || e.keyCode === 229is true, but these dialogs were missed. The IME QA item in #7036 ("when using IME keyboard to type Chinese and Japanese character and they press Enter, the Send button doesn't trigger automatically") only covers the chat input.Fix
Apply the same
isComposingguard to bothhandleKeyDownfunctions. When no IME is composing,isComposingis false, so behavior is unchanged for everyone else.Left out on purpose
SearchDialogandEditModelhave the same gap, but they are being reworked in #8288 / #8287 / #8039, so I left them untouched here to avoid conflicts. The same guard applies there.How to test
With the OS input set to a Japanese or Chinese IME, open the rename-thread or new-project dialog, type a word, and press Enter to pick a candidate. Before this change the dialog submits mid-composition; after it, it waits for a real Enter. This is the behavior
ChatInput.test.tsxalready covers ("does not submit if isComposing (IME) is true"); I can add equivalent dialog tests if you would like them.