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

Add a scrollbar to notebook/default textboxes, improve chat scrollbar style #3403

Merged
merged 8 commits into from
Aug 2, 2023

Conversation

jparmstr
Copy link
Contributor

@jparmstr jparmstr commented Aug 1, 2023

This lets the "Raw" Textbox in Notebook Mode show a vertical scrollbar when there is enough text. This is a workaround for a Gradio issue (see: gradio-app/gradio#4050, gradio-app/gradio#4044). Tested working on Edge and Chrome.

This is achieved by injecting a simple JavaScript function while creating the Gradio interface and then firing it as soon as the document loads. The same effect could be applied to any UI element by calling enableScrollBarOnElement like I do on the raw textbox here.

I tried various CSS modifications but Gradio's scroll-hide ultimately prevents CSS fixes from working. The scrollbar seems finicky and would not display even if I overrode Gradio's CSS with !important. So JavaScript was necessary.

Before:
no scrollbar

After:
scrollbar

@oobabooga
Copy link
Owner

I have moved the javascript into css/main.js and added a few more scrollbars.

Is it possible to get a consistent appearance for the scrollbars? Mine looks uglier than yours:

print

@oobabooga oobabooga changed the title Let notebook mode show a scrollbar on its textbox Add a scrollbar to notebook/default textboxes, improve chat scrollbar style Aug 2, 2023
@oobabooga oobabooga merged commit 6afc1a1 into oobabooga:main Aug 2, 2023
@oobabooga
Copy link
Owner

I have added a CSS style for the scrollbar. It can probably be made prettier, but that should do it for now. Thanks!

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.

None yet

2 participants