Skip to content

Commit 447f94b

Browse files
mylukinclaude
andcommitted
fix: iOS Safari Chinese punctuation input not working
Fix input handling for Chinese punctuation (,。!?) and spaces 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. The fix changes the condition to check `!this._compositionHelper.isComposing` instead. This correctly: - Accepts punctuation input (not composing, so we handle it) - Rejects input during actual composition (CompositionHelper handles it) - Prevents emoji duplication (emoji goes through composition flow) Fixes #3070, #4486 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2521bab commit 447f94b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/browser/CoreBrowserTerminal.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,10 +1241,13 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
12411241
* @param ev The input event to be handled.
12421242
*/
12431243
protected _inputEvent(ev: InputEvent): boolean {
1244-
// Only support emoji IMEs when screen reader mode is disabled as the event must bubble up to
1245-
// support reading out character input which can doubling up input characters
1246-
// Based on these event traces: https://github.com/xtermjs/xterm.js/issues/3679
1247-
if (ev.data && ev.inputType === 'insertText' && (!ev.composed || !this._keyDownSeen) && !this.optionsService.rawOptions.screenReaderMode) {
1244+
// Handle direct text input (not from composition).
1245+
// When composing (e.g., emoji picker, CJK IME), the CompositionHelper handles input via
1246+
// compositionend event. We skip input events during composition to prevent duplicates.
1247+
// When NOT composing, we accept input events even if ev.composed=true, which fixes
1248+
// iOS Safari Chinese punctuation input (issue #3070, #4486).
1249+
// Screen reader mode needs the event to bubble for accessibility announcements.
1250+
if (ev.data && ev.inputType === 'insertText' && !this._compositionHelper!.isComposing && !this.optionsService.rawOptions.screenReaderMode) {
12481251
if (this._keyPressHandled) {
12491252
return false;
12501253
}

0 commit comments

Comments
 (0)