Skip to content

Commit dae502b

Browse files
committed
ux: trigger focus on chat input after new chat and ctx switch
1 parent b6d152c commit dae502b

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

webui/components/chat/input/input-store.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,13 @@ const model = {
219219
await fileBrowserStore.open(path);
220220
},
221221

222+
focus() {
223+
const chatInput = document.getElementById("chat-input");
224+
if (chatInput) {
225+
chatInput.focus();
226+
}
227+
},
228+
222229
reset() {
223230
this.message = "";
224231
attachmentsStore.clearAttachments();

webui/components/sidebar/chats/chats-store.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
import { store as notificationStore } from "/components/notifications/notification-store.js";
1313
import { store as tasksStore } from "/components/sidebar/tasks/tasks-store.js";
1414
import { store as syncStore } from "/components/sync/sync-store.js";
15+
import { store as chatInputStore } from "/components/chat/input/input-store.js";
1516

1617
const model = {
1718
contexts: [],

webui/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,13 @@ export const setContext = function (id) {
557557

558558
//skip one speech if enabled when switching context
559559
if (preferencesStore.speech) skipOneSpeech = true;
560+
561+
// Focus the chat input
562+
if (id) {
563+
setTimeout(() => {
564+
inputStore.focus();
565+
}, 50);
566+
}
560567
};
561568

562569
export const deselectChat = function () {

0 commit comments

Comments
 (0)