Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(notes): ignore IME composition keys in wiki-link autocomplete (#7233)

Arne Reif9461dd6edf5
diff --git a/changelog.d/6573.bugfix.md b/changelog.d/6573.bugfix.md
new file mode 100644
index 0000000000..b4fa1ec3e9
--- /dev/null
+++ b/changelog.d/6573.bugfix.md
@@ -0,0 +1 @@
+The `[[` wiki-link autocomplete in the note editor now ignores keys that belong to an active IME composition, so the Enter that confirms a Japanese, Chinese or Korean conversion no longer inserts a suggestion.
diff --git a/src/local_deep_research/web/static/js/pages/note-detail.js b/src/local_deep_research/web/static/js/pages/note-detail.js
index ca3743ca05..002d90b2a2 100644
--- a/src/local_deep_research/web/static/js/pages/note-detail.js
+++ b/src/local_deep_research/web/static/js/pages/note-detail.js
@@ -4354,6 +4354,12 @@ function wikiLinkCaretStillAtQuery() {
function handleWikiLinkKeydown(event) {
if (!wikiLinkActive) return;
+ // Keys pressed while an IME is composing (Enter to confirm a conversion,
+ // arrows to pick a candidate) belong to the IME, not the dropdown. Safari
+ // fires compositionend before the confirming keydown, so isComposing is
+ // already false there and keyCode 229 is the only signal.
+ if (event.isComposing || event.keyCode === 229) return;
+
if (event.key === 'ArrowDown') {
event.preventDefault();
if (wikiLinkResults.length > 0) {
diff --git a/tests/js/pages/note-detail-wikilink-autocomplete.test.js b/tests/js/pages/note-detail-wikilink-autocomplete.test.js
index 6b7bd6c467..2700d57d3f 100644
--- a/tests/js/pages/note-detail-wikilink-autocomplete.test.js
+++ b/tests/js/pages/note-detail-wikilink-autocomplete.test.js
@@ -144,4 +144,32 @@ describe('wiki-link autocomplete keyboard nav', () => {
expect(ta.value).toBe('[[Foo Note]]tail stays');
expect(ev.preventDefault).toHaveBeenCalled();
});
+
+ it('leaves Enter to the IME while a composition is active', () => {
+ setupEditor();
+
+ const ev = { key: 'Enter', isComposing: true, preventDefault: vi.fn() };
+ hook.handleWikiLinkKeydown(ev);
+
+ expect(document.getElementById('note-content').value).toBe('see [[Fo');
+ expect(ev.preventDefault).not.toHaveBeenCalled();
+ });
+
+ it('leaves Enter to the IME when Safari reports keyCode 229 after compositionend', () => {
+ setupEditor();
+
+ const ev = { key: 'Enter', isComposing: false, keyCode: 229, preventDefault: vi.fn() };
+ hook.handleWikiLinkKeydown(ev);
+
+ expect(document.getElementById('note-content').value).toBe('see [[Fo');
+ expect(ev.preventDefault).not.toHaveBeenCalled();
+ });
+
+ it('does not move the active suggestion on arrow keys during a composition', () => {
+ setupEditor();
+
+ hook.handleWikiLinkKeydown({ key: 'ArrowDown', isComposing: true, preventDefault: vi.fn() });
+
+ expect(hook.getWikiLinkSelectedIndex()).toBe(0);
+ });
});