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

Auto-growing input for editing existing messages #1190

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Saghen
Copy link
Collaborator

@Saghen Saghen commented May 28, 2024

image

Changes the message input to use a <span> with contenteditable and role="textarea (for accessibility). This allows the textarea to auto-expand to the content and avoids relayout on edit. I've found it improves the UX for editing larger prompts

@Saghen Saghen requested a review from nsarrazin May 28, 2024 01:15
class:dark:bg-gray-800={editMode}
bind:this={editContentEl}
on:keydown={handleKeyDown}
contenteditable={editMode}>{message.content.trim()}</span
Copy link
Collaborator

@gary149 gary149 May 29, 2024

Choose a reason for hiding this comment

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

I can paste html and it renders:

image

I would stay with a<textarea> and do the elastic height exactly like we already do (with a max fixed height then it scrolls) on

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.

3 participants