Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Auto-focus the chat input when the chat panel opens from the collapsed FAB, so the user can type immediately without an extra click

Murtaza Nasir48923aae2e0f
diff --git a/static/js/app.modular.js b/static/js/app.modular.js
index fc7d26d6..72c171cf 100644
--- a/static/js/app.modular.js
+++ b/static/js/app.modular.js
@@ -936,6 +936,13 @@ document.addEventListener('DOMContentLoaded', async () => {
chatPanelY.value = r ? (r.bottom - chatPanelH.value - 24) : (window.innerHeight - chatPanelH.value - 80);
}
saveChatPanelPosition();
+ // Focus the input so the user can type immediately, instead of
+ // having to click into it first. nextTick waits for the panel
+ // (v-else of the FAB) to mount. A disabled input (recording not
+ // yet transcribed) just ignores focus, which is fine.
+ nextTick(() => {
+ try { chatInputRef.value?.focus(); } catch (_) { /* element not mounted */ }
+ });
};
// South-east corner resize handle drag — only active in