🉐 fix: incorrect handling for composing CJK texts in Safari #5496
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.
Summary
Fixed an issue where line breaks were not correctly applied in Mac/Safari environments for languages that require pressing the Enter key to confirm text input (e.g., Japanese, Chinese, etc.).
This issue was largely resolved for most environments in #3103, but the problem persisted in Mac/Safari due to differences in the behavior of isComposing.
In addition to using isComposing for composition detection, there are also KeyboardEvent.key and KeyboardEvent.keyCode. However, in Mac/Safari, it was impossible to make correct judgments using either isComposing or KeyboardEvent.key, so I reluctantly used keyCode for detection, despite it being deprecated.
To prevent issues when keyCode is removed in the future, I have implemented the keyCode-based detection after attempting detection using isComposing and key.
Change Type
Testing
Testing can be done using a similar approach as in #3103.
When creating the pull request, I conducted tests in the following environment:
Checklist
Please delete any irrelevant options.