Skip to content

fix: add tick() to prevent textarea height adjustment failures #1854

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

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

calycekr
Copy link
Contributor

  • Add tick() after adjustTextareaHeight() in handleKeydown to ensure DOM updates are completed before the submit event is dispatched.

Without this fix, textarea height adjustment occasionally fails to complete before the submit event fires. This inconsistent behavior creates a race condition where the UI may appear broken when pressing Enter, as the height adjustment is scheduled but not guaranteed to be applied in time.

The fix targets specifically the handleKeydown function to maintain performance while ensuring the textarea always renders with the correct height in all cases before submission.

- Add tick() after adjustTextareaHeight() in handleKeydown to ensure DOM updates are completed before the submit event is dispatched.
@nsarrazin nsarrazin merged commit 2360be8 into huggingface:main Jun 16, 2025
3 checks passed
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.

2 participants