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
Auto scroll to bottom of textbox #5417
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/63f36fe98a66d2a3610bb03688a791673d779234/gradio-3.42.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@63f36fe98a66d2a3610bb03688a791673d779234#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
Nice @dawoodkhan82! Works great. One comment -- we create the As an aside, I believe this closes: #4044 as well. The user wanted to scroll down to the bottom of the textbox to ensure that their textbox was still streaming and this change handles the underlying concern. |
@abidlabs Any reason why a user would want to disable auto scroll? I feel like our attributes are getting too granular. |
No reason comes to mind, but that's what I thought you had intended since you defined a prop ( |
@abidlabs Oh I see, I can rename. But that param is keeping track to see if the textbox needs to be scrolled. |
oh sorry I misunderstood -- my bad we're good, nvm! |
I can think of some reasons why one wants to be able to disable this or otherwise customize the behavior basically "any time when the last row of text is not the point of interest" I know of a project of a frend of my that uses Textbox as constantly updating log of activities or imagine if the logs is in reverse order, the newest line appears at the top ideally not only one would want the ability to disable this, they will want to be able to customise the scrll direction |
I agree with @w-e-w here. I actually think that autoscrolling on the Textbox may not always be a good idea since the Textbox can be used to output text all at once, where the user probably wants to start reading from the beginning. e.g. an example like this: import gradio as gr
value = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
gr.Interface(lambda x:value, "textbox", gr.Textbox(max_lines=4)).launch() I think we should add an |
How to scroll a embedded gr.HTML nested in gr.Column? |
Description
Auto scroll to bottom of textbox.
Closes: #4862
Closes: #4044
🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Tests
PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests:
bash scripts/run_all_tests.sh
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh