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

[🐛 BUG] Chat control should automatically scroll down when a new message is added #2281

Closed
1 of 7 tasks
AlexandreSajus opened this issue Nov 26, 2024 · 4 comments · Fixed by #2315
Closed
1 of 7 tasks
Assignees
Labels
GUI: Front-End 🆘 Help wanted Open to participation from the community 💥Malfunction Addresses an identified problem. 🟧 Priority: High Must be addressed as soon

Comments

@AlexandreSajus
Copy link
Contributor

AlexandreSajus commented Nov 26, 2024

What went wrong? 🤔

This is needed in a patch version of the 4.0 version.

This issue comes from a customer who needs to solve this in December.

When a new message is added in the chat control, the chat should (or should at least have the option to) automatically scroll down to see the new message, even if the chat is not scrolled all the way down.

Steps to Reproduce Issue

Using the following:

from taipy.gui import Gui
import taipy.gui.builder as tgb

messages = []


def evaluate(state, var_name: str, payload: dict):
    state.messages.append(
        [10, "The MP5 is pretty fun to shoot actually, virtually no recoil", "Robot"]
    )
    state.messages = state.messages


with tgb.Page() as page_home:
    tgb.chat(
        messages="{messages}",
        on_action=evaluate,
        height="80vh",
    )

gui = Gui(page=page_home)
gui.run()

Type a bunch of messages until there is no more space left in the chat control. The newer messages won't be visible unless you scroll.

Browsers

Chrome

OS

Windows

Version of Taipy

4.0.1

Acceptance Criteria

  • A unit test reproducing the bug is added.
  • Any new code is covered by a unit tested.
  • Check code coverage is at least 90%.
  • The bug reporter validated the fix.
  • Related issue(s) in taipy-doc are created for documentation and Release Notes are updated.

Code of Conduct

  • I have checked the existing issues.
  • I am willing to work on this issue (optional)
@AlexandreSajus AlexandreSajus added 💥Malfunction Addresses an identified problem. 🟧 Priority: High Must be addressed as soon GUI: Front-End labels Nov 26, 2024
@jrobinAV jrobinAV added the 🆘 Help wanted Open to participation from the community label Nov 29, 2024
@Akashns007
Copy link

Hi, I'd like to contribute to solving this issue. I plan to implement an automatic scroll-to-bottom functionality for the chat control when a new message is added, with an optional setting to toggle this behavior. I'll make sure to consider the current implementation and test the changes thoroughly. Please let me know if there are any specific requirements or considerations I should keep in mind. Thanks!

@FlorianJacta
Copy link
Member

I have assigned it to you!

This should automatically scroll down only if you are already scrolled down at the bottom

@FabienLelaquais
Copy link
Member

@Akashns007. This issue suddenly appears to be a priority.
We are assigning someone from the team on this as well, and let the faster win.

Here are the requirements:

  • When the chat receives its first messages, they should stack until the area becomes scrollable.
    Then the bottom area should remain visible, as if the user was scrolling down manually.
  • If the user wants to go back in the history, this auto-scroll should stop, to let the user read what needs to be.
    When new messages come in, instead of scrolling, a little overlay indicator shows that new incoming message are to be read (this is already implemented). Clicking this indicator scrolls all down the way to reveal the new messages.
  • If the chat area is scrolled entirely to the bottom (whether when it first becomes scrollable, or when the user manually scrolls all the way down, or if the 'new incoming messages' notification was clicked), then auto-scroll is re-enabled.

I see no point of providing a new property to handle this, which should be the normal behavior.

@FredLL-Avaiga FredLL-Avaiga self-assigned this Dec 10, 2024
FredLL-Avaiga pushed a commit that referenced this issue Dec 10, 2024
FabienLelaquais added a commit that referenced this issue Dec 17, 2024
* Backport to 4.0 of Taipy GUI issues #2212, #2242, #2281, #2286, #2302, and #2305.
* Upgrade JS bundles versions to 4.0.2
@FlorianJacta
Copy link
Member

Fixed in 4.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI: Front-End 🆘 Help wanted Open to participation from the community 💥Malfunction Addresses an identified problem. 🟧 Priority: High Must be addressed as soon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants