Skip to content

refactor(chat-messages): use CdkTextareaAutosize for chat input#2112

Draft
chintankavathia wants to merge 1 commit into
mainfrom
refactor/ai/chat-input/textarea-auto-size
Draft

refactor(chat-messages): use CdkTextareaAutosize for chat input#2112
chintankavathia wants to merge 1 commit into
mainfrom
refactor/ai/chat-input/textarea-auto-size

Conversation

@chintankavathia
Copy link
Copy Markdown
Member

@chintankavathia chintankavathia commented May 29, 2026

Replace the hand-rolled textarea auto-resize logic in SiChatInputComponent with Angular CDK's CdkTextareaAutosize directive (cdkAutosizeMinRows="1", cdkAutosizeMaxRows="8"). The 30vh viewport cap is preserved via CSS (max-block-size + overflow-y: auto) instead of JS.

Removes setTextareaHeight/adjustTextareaHeight and the (input) handler; behavior (min 1 row, max 8 rows, capped at 30% viewport) is unchanged.


Documentation.
Examples.
Dashboards Demo.
Playwright report.

Coverage Reports:

Code Coverage

Replace the hand-rolled textarea auto-resize logic in SiChatInputComponent
with Angular CDK's CdkTextareaAutosize directive (cdkAutosizeMinRows="1",
cdkAutosizeMaxRows="8"). The 30vh viewport cap is preserved via CSS
(max-block-size + overflow-y: auto) instead of JS.

Removes setTextareaHeight/adjustTextareaHeight and the (input) handler;
behavior (min 1 row, max 8 rows, capped at 30% viewport) is unchanged.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the chat input component to use Angular CDK's CdkTextareaAutosize directive for dynamic height adjustment, successfully removing custom height calculation logic. Feedback highlights a potential issue where the CDK directive's inline overflow-y: hidden style could prevent scrolling if the 30vh CSS height limit is reached before the 8-row limit; using overflow-y: auto !important; is recommended to resolve this.

Comment thread projects/element-ng/chat-messages/si-chat-input.component.scss
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.

1 participant