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: Correct Unwanted Newlines after Undo in Textarea #2289

Merged
merged 2 commits into from
Apr 2, 2024

Conversation

danny-avila
Copy link
Owner

@danny-avila danny-avila commented Apr 2, 2024

Summary

Hopefully the last of Textarea changes, this one targeting a chrome quirk.

I enhanced the undo functionality in LibreChat's textarea to fix a Chrome-specific bug that left unwanted newlines after undoing pasted content. The purpose of this improvement is to ensure a smoother user experience, especially when users need to undo their actions within the chat input field.

Other Changes

  • handle deprecated "backspace" identifier in KeyUp event handler
  • revise recent documentation update about docker override file concerning deploy-compose.yml usage

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update

Testing

To ensure the fix worked as intended, I replicated the problematic scenario by:

  1. Pasting multiline content into the chat input, observing the unwanted behavior of newline characters remaining after an undo operation.
  2. Applying the fix, which involved capturing the undo event and trimming any unnecessary whitespace from the end of the input field's content.

Test Configuration:

  • Browser: Google Chrome (latest version)
  • Environment: Local development

I specifically focused on testing in Chrome, as the bug was Chrome-specific. However, I also verified behavior in Firefox and Safari to ensure my fix did not adversely affect functionality in those browsers.

For effective testing, one should:

  1. Paste multiline text into the chat input.
  2. Perform an undo action using Ctrl+Z (or Cmd+Z on a Mac).
  3. Observe if any newline characters remain after the content has been undone.

Additionally, try starting with text already present in the textarea, then paste and undo to ensure the logic correctly handles content before the cursor.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes

@danny-avila danny-avila merged commit 7bd03a6 into main Apr 2, 2024
1 check passed
@danny-avila danny-avila deleted the textarea-fix branch April 2, 2024 16:14
@danny-avila
Copy link
Owner Author

danny-avila commented Apr 2, 2024

image
image

kenshinsamue pushed a commit to intelequia/LibreChat that referenced this pull request Sep 17, 2024
…#2289)

* docs: edit docker_override note for deploy-compose

* 🛠️  fix: Correct Unwanted Newlines after Undo in Textarea
BertKiv pushed a commit to BertKiv/LibreChat that referenced this pull request Dec 10, 2024
…#2289)

* docs: edit docker_override note for deploy-compose

* 🛠️  fix: Correct Unwanted Newlines after Undo in Textarea
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