Skip to content

Textarea.scroll_to_bottom alternative #1815

@mouad-ouali

Description

@mouad-ouali

I've been working on some code that used Textarea's scroll_to_bottom method. Basically, there is a textarea widget that works as a logging handler in a jupyter notebook, and everytime there is a new log message, it should scroll to the bottom to only show the latest log messages.

After updating to 7.0 , I learned that Textarea.scroll_to_bottom was removed and that it hasn't been working for a while anyway.

I've been looking for a way to make the textarea scroll to bottom by sending messages from the backend, but I can't figure out the proper way to do it. I'm not even sure it's possible using messages because the examples of custom messages I found simply called a function from the frontend, and in the case of Textarea, that function no longer exists.

I also tried looking at the model attributes of Textarea but it seems that only a few frontend attributes are exposed, therefore I cannot do something like this.$textbox.scrollTop(this.$textbox[0].scrollHeight); in Python.

Is there a different approach I could've taken to achieve the scroll to bottom behavior, and if possible, a way that works on both 7.0 and 6.0?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions