Commit c45ddce
fix: iOS Safari Chinese punctuation and emoji input
Fix input handling for Chinese punctuation (,。!?) and emoji on iOS Safari.
The issue occurs because:
1. iOS Safari fires keydown (setting _keyDownSeen=true)
2. Then fires input event with ev.composed=true
3. But NO composition events are triggered for punctuation
The old condition `(!ev.composed || !this._keyDownSeen)` would reject these
inputs because both conditions are true.
For emoji, there's a timing issue:
1. compositionend fires → isComposing becomes false
2. input event fires → old fix would accept (duplicate!)
3. setTimeout in CompositionHelper fires → sends emoji (first copy)
The fix:
1. Change condition to check `!compositionHelper.isComposing`
2. Also check `!compositionHelper.isSendingComposition` to catch the
window between compositionend and setTimeout callback
3. Add public getter for isSendingComposition in CompositionHelper
This correctly:
- Accepts punctuation input (not composing, not pending)
- Rejects input during active composition
- Rejects input when CompositionHelper has pending setTimeout
- Prevents emoji duplication
Fixes #3070, #4486
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent 2521bab commit c45ddce
File tree
5 files changed
+28
-5
lines changed- src/browser
- input
5 files changed
+28
-5
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1241 | 1241 | | |
1242 | 1242 | | |
1243 | 1243 | | |
1244 | | - | |
1245 | | - | |
1246 | | - | |
1247 | | - | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
1248 | 1254 | | |
1249 | 1255 | | |
1250 | 1256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
347 | 350 | | |
348 | 351 | | |
349 | 352 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
0 commit comments