fix(web-ui): ignore key events during IME composition (#2982)

* fix(web-ui): ignore key events during IME composition

* fix(web-ui): ignore key events during IME composition in ModelSelector
This commit is contained in:
xu0o0
2026-04-13 16:58:44 +08:00
committed by GitHub
parent 41377ee8ec
commit 6fefa6fbab
2 changed files with 6 additions and 0 deletions

View File

@@ -60,6 +60,9 @@ export class MessageEditor extends LitElement {
};
private handleKeyDown = (e: KeyboardEvent) => {
// Ignore key events during IME composition (e.g. CJK input)
if (e.isComposing || e.key === "Process") return;
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
if (!this.isStreaming && !this.processingFiles && (this.value.trim() || this.attachments.length > 0)) {

View File

@@ -113,6 +113,9 @@ export class ModelSelector extends DialogBase {
// Add global keyboard handler for the dialog
this.addEventListener("keydown", (e: KeyboardEvent) => {
// Ignore key events during IME composition (e.g. CJK input)
if (e.isComposing || e.key === "Process") return;
// Get filtered models to know the bounds
const filteredModels = this.getFilteredModels();