Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion frontend/src/lib/lemon-ui/LemonTextArea/LemonTextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface LemonTextAreaPropsBase extends Pick<
value?: string
placeholder?: string
className?: string
textareaClassName?: string
/** Whether input field is disabled */
disabled?: boolean
ref?: React.Ref<HTMLTextAreaElement>
Expand Down Expand Up @@ -54,6 +55,7 @@ export type LemonTextAreaProps = LemonTextAreaWithEnterProps | LemonTextAreaWith
export const LemonTextArea = React.forwardRef<HTMLTextAreaElement, LemonTextAreaProps>(function LemonTextArea(
{
className,
textareaClassName,
onChange,
onPressEnter,
onPressCmdEnter,
Expand All @@ -80,7 +82,12 @@ export const LemonTextArea = React.forwardRef<HTMLTextAreaElement, LemonTextArea
<TextareaAutosize
minRows={minRows}
ref={textRef}
className={cn('LemonTextArea w-full', hasFooter ? 'rounded-t' : 'rounded', className)}
className={cn(
'LemonTextArea w-full',
hasFooter ? 'rounded-t' : 'rounded',
className,
textareaClassName
)}
onKeyDown={(e) => {
if (stopPropagation) {
e.stopPropagation()
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/scenes/max/components/QuestionInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,11 @@ describe('QuestionInput slash command autocomplete', () => {
fireEvent.change(input, { target: { value: '/' } })
await waitFor(() => expect(slashCommandItem()).toBeInTheDocument())
})

it('keeps long prompts scrollable inside the input', () => {
const input = screen.getByRole('textbox')

expect(input).toHaveClass('max-h-[min(40vh,16rem)]')
expect(input).toHaveClass('overflow-y-auto')
})
})
1 change: 1 addition & 0 deletions frontend/src/scenes/max/components/QuestionInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ export const QuestionInput = React.forwardRef<HTMLDivElement, QuestionInputProps
'!border-none !bg-transparent min-h-16 py-2 pl-2 resize-none',
handsFreeFlagEnabled ? 'pr-20' : 'pr-12'
)}
textareaClassName="max-h-[min(40vh,16rem)] overflow-y-auto show-scrollbar-on-hover"
hideFocus
/>
</div>
Expand Down