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

Chatbox text area issue #455

Open
2 of 3 tasks
freedompraise opened this issue Aug 20, 2024 · 1 comment
Open
2 of 3 tasks

Chatbox text area issue #455

freedompraise opened this issue Aug 20, 2024 · 1 comment

Comments

@freedompraise
Copy link
Collaborator

Issue Description

When the user types in multiple paragraphs, the textarea expands as expected. However, after sending the message, the textarea does not shrink back to its default size. It remains expanded even though the content has been cleared.

Steps to Reproduce

  1. Open the chatbox.
  2. Type a message with multiple lines or paragraphs, causing the textarea to expand.
  3. Press "Enter" to send the message.
  4. Observe that the textarea remains expanded even after the message is sent and the content is cleared.

Expected Behavior

The textarea should reset to its default height after the message is sent and the content is cleared.

Current Behavior

The textarea retains its expanded height after the message is sent, leading to unnecessary space being displayed.

Possible Solution

The issue might be due to the way the height is being handled. After clearing the textarea, it seems the height property isn’t recalculated. We need to ensure that the height is explicitly reset after the textarea is cleared.

Here’s a potential fix:

  1. Reset the height manually after sending the message:
    Try the following update in the onSendButton method:
onSendButton() {
  const textField = this.chatBox.querySelector("#question-text-area");
  const text = textField.value.trim();
  if (text === "" || text === "\n") {
    return;
  }
  this.updateChatText(text);
  textField.value = "";
  
  // Explicitly reset the textarea height
  textField.style.height = ""; // Reset height to the default/minimum height
}

The key change should be that setting textField.style.height = "";, ensures the textarea reverts to its default height, but it's not working as supposed

Record

  • I have read the Contributing Guidelines
  • I have searched the issues for a similar request
  • I want to work on this issue
@jsolly
Copy link
Owner

jsolly commented Sep 7, 2024

I don't think this has been entirely solved by #461

If I open the chatbox and immediately press enter, an empty message is sent (expected), but the chat send box remains expanded.

In this GIF, I am simply hitting the enter key repeatedly. The chatbox should be shrunk to the original size whenever a message is sent.

CleanShot 2024-09-07 at 08 40 58

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

No branches or pull requests

2 participants