Commit adde94c11 for llama.cpp
commit adde94c11b7d71490b9279ed78adc68b2cb6c3fe
Author: Pascal <admin@serveurperso.com>
Date: Wed Nov 11 10:42:02 2026 +0100
ui: open the virtual keyboard in the chat editor on Android (#32060)
CodeMirror takes text input through EditContext on Chrome for Android
only, and there the chat editor never brings up the virtual keyboard.
The editor now always takes its input through contenteditable, as on
desktop and iOS.
A press in the input box outside the text also focuses the editor, in
the collapsed form too, so the whole box is a tap target again as the
textarea was.
diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormInput/ChatFormInput.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormInput/ChatFormInput.svelte
index 93b5bd421..540a344da 100644
--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormInput/ChatFormInput.svelte
+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormInput/ChatFormInput.svelte
@@ -84,16 +84,19 @@
onInput?.();
}
- // The expanded editor is taller than its text: a click on the empty room below it
- // continues writing at the end, as in a textarea
+ // The box is larger than its text (padding, and the room below it when expanded): a press
+ // on it outside the text continues writing at the end, as in a textarea. A press on a
+ // scrollbar, past the target's client width, still drags it
function handleMouseDown(event: MouseEvent) {
const content = editor?.getContentDOM();
+ const target = event.target as HTMLElement;
if (
event.button !== 0 ||
- !expanded ||
+ disabled ||
!content ||
- event.clientY <= content.getBoundingClientRect().bottom
+ content.contains(target) ||
+ event.offsetX >= target.clientWidth
) {
return;
}
diff --git a/tools/ui/src/lib/components/app/content/MarkdownEditor/MarkdownEditor.svelte b/tools/ui/src/lib/components/app/content/MarkdownEditor/MarkdownEditor.svelte
index cf0f36167..921deef46 100644
--- a/tools/ui/src/lib/components/app/content/MarkdownEditor/MarkdownEditor.svelte
+++ b/tools/ui/src/lib/components/app/content/MarkdownEditor/MarkdownEditor.svelte
@@ -1,3 +1,15 @@
+<script lang="ts" module>
+ import { EditorView } from '@codemirror/view';
+
+ /**
+ * Takes text input through contenteditable on every browser: Chrome on Android opens no
+ * virtual keyboard for an editor that takes it through EditContext.
+ */
+ class ContentEditableView extends EditorView {
+ static EDIT_CONTEXT = false;
+ }
+</script>
+
<script lang="ts">
import '$lib/styles/katex-custom.scss';
import MarkdownSurface from '../MarkdownContent/MarkdownSurface.svelte';
@@ -25,7 +37,7 @@
type Extension,
Transaction
} from '@codemirror/state';
- import { EditorView, keymap, placeholder as placeholderExt } from '@codemirror/view';
+ import { keymap, placeholder as placeholderExt } from '@codemirror/view';
import { tags } from '@lezer/highlight';
import { DialogCodePreview, DialogMermaidPreview } from '$lib/components/app';
import { ColorMode } from '$lib/enums';
@@ -137,7 +149,7 @@
if (!host) return;
docText = value;
- view = new EditorView({
+ view = new ContentEditableView({
parent: host,
state: EditorState.create({
doc: value,