-
Notifications
You must be signed in to change notification settings - Fork 111
fix: Korean/CJK IME composition events not captured #120
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
f572fa1
3180b52
efeacec
3db9771
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -717,15 +717,21 @@ export class Terminal implements ITerminalCore { | |
| * Focus terminal input | ||
| */ | ||
| focus(): void { | ||
| if (this.isOpen && this.element) { | ||
| // Focus immediately for immediate keyboard/wheel event handling | ||
| this.element.focus(); | ||
|
|
||
| // Also schedule a delayed focus as backup to ensure it sticks | ||
| // (some browsers may need this if DOM isn't fully settled) | ||
| setTimeout(() => { | ||
| this.element?.focus(); | ||
| }, 0); | ||
| if (this.isOpen) { | ||
| // Focus the textarea for keyboard/IME input. | ||
| // The textarea is the actual input element that receives keyboard events | ||
| // and IME composition events. Focusing the container doesn't work for IME | ||
| // because composition events fire on the focused element. | ||
| const target = this.textarea || this.element; | ||
| if (target) { | ||
| target.focus(); | ||
|
Comment on lines
+758
to
+760
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
|
|
||
| // Also schedule a delayed focus as backup to ensure it sticks | ||
| // (some browsers may need this if DOM isn't fully settled) | ||
| setTimeout(() => { | ||
| target?.focus(); | ||
| }, 0); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
The new focus path now targets the hidden textarea when it exists, but
blur()still callsthis.element.blur(). When the terminal is open (default case creates the textarea), callingterminal.blur()will leave the textarea focused, so keyboard/IME input continues to be captured even though callers expect blur to release focus. This is a regression introduced by switching focus to the textarea. Consider blurring the same target (this.textarea || this.element) or explicitly blurring the textarea when present.Useful? React with 👍 / 👎.