From af4d78136a17e614870df5f9eae1f4e57bfb457e Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 28 Apr 2026 21:08:46 -0400 Subject: [PATCH] fix: textarea height setting now visibly changes empty-state size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous approach used a 600ms preview animation + syncHeight() which collapsed the textarea back to 1 line (empty scrollHeight). Now syncHeight enforces minHeight = maxHeight/3, so each setting (S/M/L) has a visibly distinct resting height even when the input is empty. S (120px): min ~40px ≈ 1-2 lines at rest M (240px): min ~80px ≈ 3 lines at rest L (480px): min ~160px ≈ 5-6 lines at rest Co-Authored-By: Claude Sonnet 4.6 --- cortex/static/app.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/cortex/static/app.js b/cortex/static/app.js index 0ab4af2..5be09f7 100644 --- a/cortex/static/app.js +++ b/cortex/static/app.js @@ -151,7 +151,9 @@ inputEl.style.height = 'auto'; inputEl.style.maxHeight = maxHeight + 'px'; const sh = inputEl.scrollHeight; - inputEl.style.height = Math.min(sh, maxHeight) + 'px'; + // Minimum height is 1/3 of maxHeight so each setting is visually distinct + const minH = Math.round(maxHeight / 3); + inputEl.style.height = Math.max(Math.min(sh, maxHeight), minH) + 'px'; } function updateHeightUI() { @@ -169,13 +171,7 @@ maxHeight = HEIGHT_SIZES[nextIdx]; localStorage.setItem('maxHeight', maxHeight); updateHeightUI(); - if (!inputEl.value.trim()) { - inputEl.style.transition = 'height 0.2s ease'; - inputEl.style.height = maxHeight + 'px'; - setTimeout(syncHeight, 600); - } else { - syncHeight(); - } + syncHeight(); }); }