From 53160e57a1bf65812ddade7e4e71d0c3a75e812c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 2 Oct 2026 07:41:32 -0700 Subject: Message box: no scrollbar until the text outgrows it growComposer sized the border-box field to scrollHeight, two pixels short of its own content (the border), so even an empty box overflowed and showed a scrollbar. Count the border, and scroll only at the height cap. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Dmcrt9KyNDKVWFKnb8BREo --- src/features/messages.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/features') diff --git a/src/features/messages.js b/src/features/messages.js index 1a5eead..9e73db3 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -8917,9 +8917,16 @@ export function messagesFeature(ctx) { // Enter sends; Shift+Enter (the textarea's native edit) and Ctrl+J insert // a newline. Height follows the text as it's typed — imperatively, since // typing doesn't re-render — with rows as the re-render fallback. + // The box is border-box, so its height carries the border too: sized to + // scrollHeight alone it came up two pixels short of its own text, and an + // empty field grew a scrollbar. It scrolls only once it hits the cap. const growComposer = (el) => { el.style.height = 'auto'; - el.style.height = Math.min(el.scrollHeight, 120) + 'px'; + const border = el.offsetHeight - el.clientHeight; + const want = el.scrollHeight + border; + const cap = parseFloat(getComputedStyle(el).maxHeight) || 120; + el.style.height = Math.min(want, cap) + 'px'; + el.style.overflowY = want > cap ? 'auto' : 'hidden'; }; // ---- :shortcode: autocomplete in the composer ----------------------------- // A colon and two letters at the caret open a strip of matches above the -- cgit v1.2.3