fix(keymap): Don't run the Enter that commits an input-method candidate

WebKit sends the Enter (or Space) that commits a candidate after compositionend,
with isComposing already false and keyCode 229. Handlers that checked isComposing
alone ran it: dialogs confirmed and shortcuts fired while typing Chinese or
Japanese. isImeKey() checks both, and every keydown handler that skipped
composition uses it.
Цей коміт міститься в:
l0ng-ai committed 2026-10-27 17:16:46 +08:00
1 джерело 2c576418cb
коміт f73c0a6b1d
10 files changed
+26 -9

No files matched your search

+2 -1
Переглянути файл
@@ -6,6 +6,7 @@ import { sshLabel } from "./model";
import { SourceDialog } from "./SourceDialog";
import { closeDialog, useDatabase } from "./store";
import styles from "./Database.module.css";
import { isImeKey } from "@/platform/ime";
const ObjectDialogs = lazyComponent(() => import("./ObjectDialogs").then((m) => m.ObjectDialogs));
const ExportDialog = lazyComponent(() => import("./ExportDialog").then((m) => m.ExportDialog));
@@ -138,7 +139,7 @@ function ParamsDialog({
<div
className={styles.form}
onKeyDown={(e) => {
if (e.key !== "Enter" || e.nativeEvent.isComposing) return;
if (e.key !== "Enter" || isImeKey(e.nativeEvent)) return;
e.preventDefault();
done(values);
}}
+2 -1
Переглянути файл
@@ -23,6 +23,7 @@ import { colorVar, connectRemedy, fileSourceName, newSourceId, parseSourceUrl, s
import { closeDialog, loadDatabases, loadSchemas, saveSource, useDatabase } from "./store";
import { VENDORS, sourceUrl, vendorById, vendorOf } from "./vendors";
import styles from "./Database.module.css";
import { isImeKey } from "@/platform/ime";
type Tab = "general" | "options" | "ssh" | "schemas" | "advanced";
@@ -284,7 +285,7 @@ function NamePicker({
aria-label={`Add ${title} pattern`}
onChange={(e) => setPattern(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Enter" && !e.nativeEvent.isComposing) {
if (e.key === "Enter" && !isImeKey(e.nativeEvent)) {
e.preventDefault();
add();
}