aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-02 07:41:32 -0700
committerAdam Soltys <[email protected]>2026-10-02 07:41:32 -0700
commit53160e57a1bf65812ddade7e4e71d0c3a75e812c (patch)
tree6580c3a7b9855440a98b158c39b030b31ed5b19a
parent9989970a976f387d9d766d38c21735171403879e (diff)
downloadcoinosv3-53160e57a1bf65812ddade7e4e71d0c3a75e812c.tar.gz
coinosv3-53160e57a1bf65812ddade7e4e71d0c3a75e812c.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_01Dmcrt9KyNDKVWFKnb8BREo
-rw-r--r--src/features/messages.js9
1 files changed, 8 insertions, 1 deletions
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