Skip to content

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

Python

Mobile chat send: revert @mousedown.prevent; instead debounce keyboard-open removal so the Send tap doesn't reflow the layout, and the natural blur ends IME composition so the input actually clears after send

Murtaza Nasir65c1a13e187d
diff --git a/templates/components/detail/floating-chat.html b/templates/components/detail/floating-chat.html
index 9f7d281f..026bcb04 100644
--- a/templates/components/detail/floating-chat.html
+++ b/templates/components/detail/floating-chat.html
@@ -185,7 +185,6 @@
style="resize: none;"
rows="2"></textarea>
<button @click="sendChatMessage"
- @mousedown.prevent
:disabled="!chatInput.trim() || isChatLoading || selectedRecording.status !== 'COMPLETED' || processedTranscription.isError"
class="btn btn--primary btn--icon btn--lg"
:title="t('buttons.send') || 'Send'">
diff --git a/templates/components/detail/mobile-chat-panel.html b/templates/components/detail/mobile-chat-panel.html
index fb059a16..74206e0e 100644
--- a/templates/components/detail/mobile-chat-panel.html
+++ b/templates/components/detail/mobile-chat-panel.html
@@ -52,7 +52,6 @@
style="resize: none;"
rows="2"></textarea>
<button @click="sendChatMessage"
- @mousedown.prevent
:disabled="!chatInput.trim() || isChatLoading || selectedRecording.status !== 'COMPLETED' || processedTranscription.isError"
class="btn btn--primary btn--icon btn--lg">
<i class="fas fa-paper-plane"></i>
diff --git a/templates/index.html b/templates/index.html
index 70124c08..93d38688 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -33,8 +33,24 @@
}
return el.isContentEditable === true;
}
- document.addEventListener('focusin', function (e) { if (isTextField(e.target)) root.classList.add('keyboard-open'); });
- document.addEventListener('focusout', function (e) { if (isTextField(e.target)) root.classList.remove('keyboard-open'); });
+ // Defer removing keyboard-open on blur. Tapping a button next to the
+ // input (e.g. chat Send) briefly blurs the field, then code refocuses
+ // it to keep the keyboard up. Removing the class immediately would
+ // un-hide the player/nav and reflow the layout mid-tap — moving the
+ // button out from under the finger so the click misses. Deferring lets
+ // the refocus (focusin) cancel the removal, so the layout stays stable.
+ // It also means the blur fires normally, ending the mobile IME
+ // composition so the field actually clears after send.
+ var kbTimer = null;
+ document.addEventListener('focusin', function (e) {
+ if (isTextField(e.target)) { clearTimeout(kbTimer); root.classList.add('keyboard-open'); }
+ });
+ document.addEventListener('focusout', function (e) {
+ if (isTextField(e.target)) {
+ clearTimeout(kbTimer);
+ kbTimer = setTimeout(function () { root.classList.remove('keyboard-open'); }, 400);
+ }
+ });
})();
</script>
<meta name="csrf-token" content="{{ csrf_token() }}">