fix: Prevent Enter during IME compose in submission dialogs#2803
Open
neverether wants to merge 1 commit into
Open
fix: Prevent Enter during IME compose in submission dialogs#2803neverether wants to merge 1 commit into
neverether wants to merge 1 commit into
Conversation
2 tasks
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.
Description
When typing with an IME (e.g. Japanese, Chinese, Korean), pressing Enter to confirm a character conversion immediately submitted dialogs. For example, in the "New Space" dialog, typing
tesutoand pressing Enter to accept the テスト conversion created the space right away, before the user could finish typing the intended name.This happens because the keydown that confirms an IME composition is delivered to the page as a regular Enter keydown on macOS (Windows IMEs swallow it, so the bug only manifests on macOS), and the Enter handlers never checked
KeyboardEvent.isComposing.Changes:
isComposingEventhelper toweb-pkgthat treats an event as part of a composition session whenisComposingis set, or whenkeyCodeis 229 for browsers that fire the composition-ending keydown withisComposingalready unset (e.g. Safari).OcModalinput (covers New Space, New Folder, New File, Rename, Edit Description and every otherhasInputmodal) — check inlined here since the design system cannot importweb-pkgSetLinkPasswordModal— browsers suppress IMEs ontype="password"inputs, but the field's "show password" toggle switches it totype="text", where the IME is active and the same premature submit occursFileNameModal(external app)CreateShortcutModaldrop selectionBefore:
https://github.com/user-attachments/assets/674bca8a-09b0-4229-9e5c-2197616386d8
After:
https://github.com/user-attachments/assets/cb3badf9-cb47-4fc9-ac9e-66be34f2b286
Note: This PR also covers the Password Edit dialog – there may be a potential oversight in this area. When typing in a password with the password mask on (input type = password), IMEs and blocked and we're limited to safe alphanumeric password input. However when the mask is off (clicking the eyeball icon, the type = text), it's now possible to utilize the IME to input unicode. I'm not sure this is the intended policy and can cause passwords with unintended values/inputs. This might need addressing, but I'm uncertain of the intent here.
Related Issue
How Has This Been Tested?
tesuto, press Enter to confirm the テスト conversion → the dialog no longer submits; a subsequent plain Enter submits as before. Same for rename and other input dialogs.isComposing: trueorkeyCode === 229does not emit confirm, plain Enter does.Types of changes