-
-
Notifications
You must be signed in to change notification settings - Fork 275
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: Prevent IME-exiting Enter press from sending message on Safari #2175
base: dev
Are you sure you want to change the base?
Conversation
On most browsers, pressing Enter to end IME composition produces this sequence of events: * keydown (keycode 229, key Processing/Unidentified, isComposing true) * compositionend * keyup (keycode 13, key Enter, isComposing false) On Safari, the sequence is different: * compositionend * keydown (keycode 229, key Enter, isComposing false) * keyup (keycode 13, key Enter, isComposing false) This causes Safari users to mistakenly send their messages when they press Enter to confirm their choice in an IME. The workaround is to treat the next keydown with keycode 229 as if it were part of the IME composition period if it occurs within a short time of the compositionend event. Fixes cinnyapp#2103, but needs confirmation from a Safari user.
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pathes for these 2 imports is incorrect so it can't get resolved properly
Besides that, this PR fixes IME errors for me. I can type in Japanese normally ❤️
@@ -47,6 +47,7 @@ import { settingsAtom } from '../../state/settings'; | |||
import { isMacOS } from '../../utils/user-agent'; | |||
import { KeySymbol } from '../../utils/key-symbol'; | |||
import { useMatrixClient } from '../../hooks/useMatrixClient'; | |||
import { isComposing } from '../../utils/keyboard.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { isComposing } from '../../utils/keyboard.js'; | |
import { isComposing } from '../../utils/keyboard; |
@@ -27,6 +27,7 @@ import { useKeyDown } from '../../hooks/useKeyDown'; | |||
import { openSearch } from '../../../client/action/navigation'; | |||
import { useMatrixClient } from '../../hooks/useMatrixClient'; | |||
import { factoryRoomIdByActivity } from '../../utils/sort'; | |||
import { isComposing } from '../../utils/keyboard.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { isComposing } from '../../utils/keyboard.js'; | |
import { isComposing } from '../../utils/keyboard'; |
Description
On most browsers, pressing Enter to end IME composition produces this sequence of events:
On Safari, the sequence is different:
This causes Safari users to mistakenly send their messages when they press Enter to confirm their choice in an IME.
The workaround is to treat the next keydown with keycode 229 as if it were part of the IME composition period if it occurs within a short time of the compositionend event.
Fixes #2103, but needs confirmation from a Safari user.
Type of change
Checklist: