composer: clicking anywhere in the box focuses the message field
Paul: the whole compose box should place the cursor, not only the text line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+12
−0
internal/equipo/static/chat.js+10 −0internal/equipo/static/equipo.css+2 −0
CI passed — run details
Intent
diff --git a/internal/equipo/static/chat.js b/internal/equipo/static/chat.js| index d4ef91f3..38667697 100644 |
| --- a/internal/equipo/static/chat.js |
| +++ b/internal/equipo/static/chat.js |
| @@ -48,6 +48,16 @@ |
| e.preventDefault(); |
| if (e.target.form.getAttribute("aria-busy") !== "true") e.target.form.requestSubmit(e.target.form.querySelector("button[type=submit]")); |
| }); |
| + // A click anywhere in the composer box puts the caret in the message field. |
| + chat.addEventListener("click", function (e) { |
| + var box = e.target.closest("#composer"); |
| + if (!box || e.target.closest("textarea, button, select, a, input, label")) return; |
| + var input = box.querySelector("textarea"); |
| + if (!input || input.readOnly) return; |
| + input.focus({ preventScroll: true }); |
| + var end = input.value.length; |
| + input.setSelectionRange(end, end); |
| + }); |
| function retainHistory(changes) { |
| var list = chat.querySelector("[equipo-feed]"); |
| var dates = new Map(); |
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css| index 38aa3777..0b75acaa 100644 |
| --- a/internal/equipo/static/equipo.css |
| +++ b/internal/equipo/static/equipo.css |
| @@ -113,6 +113,8 @@ body:has([equipo-conversation]) { overflow: hidden; } |
| [equipo-question] [equipo-actions] { margin-block: var(--rst-sp-2) 0; } |
| #chat-composer { flex: none; padding: var(--rst-sp-3) max(var(--rst-sp-4), calc((100% - 50rem) / 2)) max(var(--rst-sp-3), env(safe-area-inset-bottom)); background: var(--rst-surface); } |
| #composer { display: grid; max-width: none; margin: 0; padding: var(--rst-sp-3); border: 1px solid var(--rst-line); border-radius: calc(2 * var(--rst-radius)); gap: var(--rst-sp-2); } |
| +#composer { cursor: text; } |
| +#composer button, #composer select { cursor: pointer; } |
| #composer:focus-within { border-color: color-mix(in oklab, var(--rst-line), var(--rst-text) 30%); } |
| #composer textarea:focus, #composer textarea:focus-visible { outline: none; box-shadow: none; } |
| @media (pointer: coarse) { #composer textarea { font-size: max(1rem, 16px); } } |