fix(max): constrain ai chat prompt height#28
Open
lordspline wants to merge 1 commit into
Open
Conversation
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
🔍 Visual QA —
|
Before (master) |
After (PR) |
|---|---|
maxRows={10} constrains textarea to ~216 px; native browser scrollbar appears when content overflows |
CSS max-h-[min(40vh,16rem)] + overflow-y: auto added explicitly; scrollbar styled via show-scrollbar-on-hover (hidden until hover) |
Narrow — 390 × 700
| Before | After |
|---|---|
| Textarea height=216 px (maxRows), scrollHeight=1192 px; native scrollbar visible | Same visual height, CSS constraint max-h-256px at this viewport; scrollbar styled |
Key findings
- ✅ Send button (
→) remains visible and accessible in all tested states - ✅
Auto/Add contexttoolbar row remains accessible below the input - ✅
textareaClassNamecorrectly targets only the inner<textarea>element (not the wrapper<div>) - ℹ️ At desktop (1280 px), the visual change is subtle —
maxRows={10}already caps at ~216 px, andmin(40vh, 16rem) = 256 pxis a looser bound. The CSS constraint becomes the binding limit when viewport height falls below ~540 px (i.e. on short screens or with soft keyboard open), where40vh < 216 px. - ℹ️
show-scrollbar-on-hoverreplaces the always-visible native browser scrollbar with a PostHog-styled thin scrollbar that appears on hover — consistent with how other scrollable areas in the app behave (Navigation, ScrollableShadows, ModeSelector).
One minor note: In LemonTextArea, the existing className prop is applied to both the outer wrapper <div> (line 79) and the <TextareaAutosize> (line 83). The new textareaClassName goes only to <TextareaAutosize>. This is the right separation, though it also means any class in the current className that's textarea-specific could be migrated over in a follow-up for clarity.
Overall the behavior is correct and the send button stays accessible. 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Problem
Long prompts in the PostHog AI chat could keep growing the prompt textarea until the send button was pushed out of reach.
Closes PostHog#62461
Changes
textareaClassNametoLemonTextAreaso callers can style only the actual<textarea>instead of also styling the wrapper.min(40vh, 16rem)and enable internal vertical scrolling so the send button remains visible.How did you test this code?
I am an agent. I ran: