Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ai): adjust chat input height dynamically #14432

Merged
merged 2 commits into from
Nov 12, 2024

Conversation

planger
Copy link
Contributor

@planger planger commented Nov 11, 2024

What it does

So far the height of the chat input field only was increased with Ctrl+Enter, but not when the lines broke due to their length, or when the view was resized.

With this change, we adapt the height of the input also during normal typing when the content wraps into a new line. Moreover, we add a short transition when adjusting the height to make it look smoother.

How to test

output2.webm

Type long text into the AI Chat input and observe how the height is adjusted up to a maximum height. Also resize the chat window until the line wrapping is affected, and type Ctrl+Enter.

Follow-ups

None

Review checklist

Reminder for reviewers

So far the height of the chat input field only was increased with Ctrl+Enter, but not when the lines broke due to their length, or when the view was resized.

With this change, we adapt the height of the input also during normal typing when the content wraps into a new line. Moreover, we add a short transition when adjusting the height to make it look smoother.
@planger planger force-pushed the planger/ai/adjust-chat-input-height branch from ada2378 to ccbfead Compare November 11, 2024 16:24
Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

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

Works great for me. Good work! ❤️

I just have a minor nitpick.

@@ -126,14 +126,17 @@ const ChatInput: React.FunctionComponent<ChatInputProperties> = (props: ChatInpu
const lastRequest = allRequests.length === 0 ? undefined : allRequests[allRequests.length - 1];

const createInputElement = async () => {
const padding = 8;
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: For consistency I would call this paddingTop as it's only used for that

@planger planger merged commit 1e4a00d into master Nov 12, 2024
11 checks passed
@planger planger deleted the planger/ai/adjust-chat-input-height branch November 12, 2024 15:37
@github-actions github-actions bot added this to the 1.56.0 milestone Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants