diff --git a/services/frontend/src/app/forum/uj/NewThreadForm.tsx b/services/frontend/src/app/forum/uj/NewThreadForm.tsx index 4ce19f8..97be30d 100644 --- a/services/frontend/src/app/forum/uj/NewThreadForm.tsx +++ b/services/frontend/src/app/forum/uj/NewThreadForm.tsx @@ -86,8 +86,8 @@ export function NewThreadForm({ if (t?.listening && intent === "") setIntent("listen"); } - async function submit(e: React.FormEvent) { - e.preventDefault(); + async function submit() { + if (busy || !title.trim() || !body.trim() || !topic) return; setBusy(true); setError(null); try { @@ -109,7 +109,9 @@ export function NewThreadForm({ } return ( -
+ // Not a : iOS Safari offers its card and address AutoFill for the + // text boxes of a form. The button sends; Ctrl/Cmd+Enter in the text too. +
{share && (
setShare(null)} /> @@ -176,7 +178,7 @@ export function NewThreadForm({ {intentHint &&

{intentHint}

} -
+
@@ -203,12 +205,23 @@ export function NewThreadForm({ required autoComplete="off" placeholder={intent === "listen" ? "Írd le, ami benned van…" : "Írd le a gondolataidat…"} + onKeyDown={(e) => { + if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) { + e.preventDefault(); + void submit(); + } + }} />
Kérjük, tartsd be a házirendet. -
@@ -219,6 +232,6 @@ export function NewThreadForm({ {error}

)} - +
); } diff --git a/services/frontend/src/components/KeyboardSafe.tsx b/services/frontend/src/components/KeyboardSafe.tsx index 1183fef..f91d60d 100644 --- a/services/frontend/src/components/KeyboardSafe.tsx +++ b/services/frontend/src/components/KeyboardSafe.tsx @@ -51,7 +51,8 @@ export function KeyboardSafe() { measure(); const top = vv ? vv.offsetTop : 0; const height = vv ? vv.height : window.innerHeight; - const form = el.closest("form"); + // The box with its send button: a form, or a block marked for it. + const form = el.closest("form, [data-kb-block]"); const target = form && form.getBoundingClientRect().height < height * 0.6 ? form : el; const rect = target.getBoundingClientRect(); const free = { top: top + 12, bottom: top + height - 16 }; diff --git a/services/frontend/src/components/forum/Composer.tsx b/services/frontend/src/components/forum/Composer.tsx index adfd326..e96ba7c 100644 --- a/services/frontend/src/components/forum/Composer.tsx +++ b/services/frontend/src/components/forum/Composer.tsx @@ -91,8 +91,7 @@ export function Composer({ }); } - async function submit(e: React.FormEvent) { - e.preventDefault(); + async function submit() { if (!text.trim() || busy) return; const final = convertEmoticons(text, text.length, true).text; if (await onSubmit(final)) { @@ -101,8 +100,10 @@ export function Composer({ } } + // Not a
: iOS Safari offers its card and address AutoFill for the text + // boxes of a form. The button sends; Ctrl/Cmd+Enter too. return ( - +
@@ -120,6 +121,10 @@ export function Composer({ }} onKeyDown={(e) => { if (e.key === "Escape") setSuggest(null); + if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) { + e.preventDefault(); + void submit(); + } }} maxLength={10000} autoComplete="off" @@ -150,10 +155,15 @@ export function Composer({ Mégse )} -
-
+
); }