Skip to content

IMPLEMENT: auto-grow PromptInput up to 8 lines (#237)#240

Merged
DaveHudson merged 4 commits intomainfrom
sandcastle/issue-237-prompt-input-grow
May 1, 2026
Merged

IMPLEMENT: auto-grow PromptInput up to 8 lines (#237)#240
DaveHudson merged 4 commits intomainfrom
sandcastle/issue-237-prompt-input-grow

Conversation

@DaveHudson
Copy link
Copy Markdown
Collaborator

Summary

  • IMPLEMENT: auto-grow PromptInput up to 8 lines (Prompt Input Grow #237)
  • REVIEW: fix broken import alias and add height-reset edge case test

Closes #237

DaveHudson added 3 commits May 1, 2026 11:55
Fixed the textarea in ChatPanel not growing as the user types multi-line
prompts. The auto-grow useEffect had an empty dependency array so it only
fired at mount; changing the dep to [input] makes it recalculate height on
every keystroke. Also removed the conflicting max-h-32 Tailwind class
(replaced by the inline-style cap) and replaced the hardcoded 160px ceiling
with a computed value of lineHeight×8 + vertical padding so the limit
correctly represents 8 lines regardless of font metrics.

Files changed:
- apps/desktop/src/renderer/src/components/chat/ChatPanel.tsx
- apps/desktop/tests/components/chat/ChatPanel.test.tsx
Fix `./gh` typo in eligibility.test.ts (no such file; only github.ts
exists). The import type was silently erased at runtime so tests passed,
but tsc caught the error. Add a test asserting the textarea height
shrinks back when input is cleared.
// Auto-grow the textarea up to a cap so prompts with a few lines
// don't force the user to scroll a single-line input.
// Auto-grow the textarea up to 8 lines; content scrolls beyond that.
// biome-ignore lint/correctness/useExhaustiveDependencies: input is the intended trigger; the effect reads the DOM via textareaRef
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do NOT want to biome-ignore, bad pattern.

Also why this useEffect? We have Tailwind & Shadcn, surely there are better options than this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in bfa9866.

  • Auto-grow is now CSS-only via Tailwind v4's field-sizing-content plus a max-h-[calc(8*1.25rem+1.25rem)] cap and overflow-y-auto. Electron 35 = Chromium 134, so field-sizing: content is supported. The useEffect, the textareaRef, and the inline-style writes are all gone.
  • The other biome-ignore (scroll-on-new-message) is also gone — extracted messages.length to a const and depend on that, which satisfies useExhaustiveDependencies without a suppression.
  • Added a rule to .sandcastle/CODING_STANDARDS.md banning biome-ignore / @ts-ignore / eslint-disable. If a rule fires we fix the underlying code.

Tests: replaced the JSDOM scrollHeight / style.height assertions with className-contract checks, since height is now a pure CSS concern.

Drop the JS-driven textarea height effect and biome-ignore in favour of
the CSS `field-sizing: content` property paired with a `max-h` cap and
`overflow-y-auto`. Tailwind v4 ships the `field-sizing-content` utility
and Electron 35 (Chromium 134) supports the property natively.

Also collapse the scroll-on-new-message effect to depend on
`messages.length` (extracted to a const so biome no longer flags the
dependency) instead of suppressing useExhaustiveDependencies.

Tests: replace JSDOM scrollHeight/style.height assertions with className
contract checks — height is now a CSS concern, not observable behaviour
in JSDOM.

Add a CODING_STANDARDS rule banning biome-ignore / @ts-ignore /
eslint-disable across the codebase.
@DaveHudson DaveHudson enabled auto-merge May 1, 2026 12:37
@DaveHudson DaveHudson merged commit 8bd7624 into main May 1, 2026
3 checks passed
@DaveHudson DaveHudson deleted the sandcastle/issue-237-prompt-input-grow branch May 1, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prompt Input Grow

1 participant