ux: trigger focus on chat input after new chat and ctx switch

Alessandro committed Mar 27, 2026 at 12:12 UTC dae502bc1d2c9eb82cfcc7303f9225ac5f3ee4c5
3 files changed +15
webui/components/chat/input/input-store.js
+7
@@ -219,6 +219,13 @@ const model = {
219 await fileBrowserStore.open(path);
220 },
221
222 + focus() {
223 + const chatInput = document.getElementById("chat-input");
224 + if (chatInput) {
225 + chatInput.focus();
226 + }
227 + },
228 +
229 reset() {
230 this.message = "";
231 attachmentsStore.clearAttachments();
webui/components/sidebar/chats/chats-store.js
+1
@@ -12,6 +12,7 @@ import {
12 import { store as notificationStore } from "/components/notifications/notification-store.js";
13 import { store as tasksStore } from "/components/sidebar/tasks/tasks-store.js";
14 import { store as syncStore } from "/components/sync/sync-store.js";
15 +import { store as chatInputStore } from "/components/chat/input/input-store.js";
16
17 const model = {
18 contexts: [],
webui/index.js
+7
@@ -557,6 +557,13 @@ export const setContext = function (id) {
557
558 //skip one speech if enabled when switching context
559 if (preferencesStore.speech) skipOneSpeech = true;
560 +
561 + // Focus the chat input
562 + if (id) {
563 + setTimeout(() => {
564 + inputStore.focus();
565 + }, 50);
566 + }
567 };
568
569 export const deselectChat = function () {