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

Limit chat input height to 20 lines #877

Merged
merged 2 commits into from
Jul 8, 2024

Conversation

krassowski
Copy link
Member

Fixes #796

Before After After (Firefox)
Screenshot from 2024-07-07 16-47-33 Screenshot from 2024-07-07 16-48-01 image

Why 20? Because in my testing I saw that:

  • ChatGPT limits displayed lines to 20
  • VSCode limits displayed lines to 10

I think it is better to go with a larger number. I am happy to change it to a different number based on review though :)

As to the visible scrollbar in Chrome:

  • VSCode appears to hide scrollbars (which is not very accessible), ChatGPT shows it the same
  • we could use scrollbar-width: thin or change the side of the scrollbar (here simulated with direction: rtl; text-align: left; trick, but it is not accessible; there is a clean solution but mui does not support it)
Chrome as-is Chrome thin Chrome flipped side
Screenshot from 2024-07-07 16-48-01 image image

Alternatively we could move it to the right of the send button by reimplementing endAdornment as an element placed outside; this is trivial by making it position: absolute; right: 20px but would need some background to cover the text which might be underneath:

image

While covering some text might be annoying at times, this could be a good tradeoff as it would increase the width available for the user prompt.

@krassowski krassowski added the bug Something isn't working label Jul 7, 2024
Copy link
Member

@dlqqq dlqqq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krassowski Thank you for opening this PR! I just pushed a commit that binds the "Send" button to the bottom of the chat input to prevent it from moving as a user types a long prompt. Avoiding excessive movement of UI elements is better for user experience, in my opinion.

Two questions:

  1. Can you test this PR w/ my additional commit to ensure it works on your browsers as well?
  2. Do you know why the scrollbar is not showing in Firefox, per your screenshot in the description of this PR?

@dlqqq
Copy link
Member

dlqqq commented Jul 8, 2024

Here is the UI I see locally after building my additional changes:

Screenshot 2024-07-08 at 9 05 18 AM

@krassowski
Copy link
Member Author

Do you know why the scrollbar is not showing in Firefox, per your screenshot in the description of this PR?

The scrollbar is there, just only showing on hover. Firefox (at least on Ubuntu) uses so called overlay scrollbars. Chrome also uses them if user opt-in and on some OSes. There was a proposal to allow to change it via CSS but I think there was some opposition.

@krassowski
Copy link
Member Author

Can you test this PR w/ my additional commit to ensure it works on your browsers as well?

Done, looks good to me!

Copy link
Member

@dlqqq dlqqq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krassowski Awesome, thank you! Merging.

@dlqqq dlqqq enabled auto-merge (squash) July 8, 2024 17:41
@dlqqq dlqqq disabled auto-merge July 8, 2024 17:41
@dlqqq dlqqq changed the title Limit the number of displayed rows in chat input to 20 Limit chat input height to 20 lines Jul 8, 2024
@dlqqq dlqqq enabled auto-merge (squash) July 8, 2024 17:42
@dlqqq dlqqq merged commit fdb8456 into jupyterlab:main Jul 8, 2024
9 checks passed
@krassowski krassowski mentioned this pull request Jul 11, 2024
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* Limit the number of displayed rows in chat input to 20

* affix send button to bottom of chat input

---------

Co-authored-by: David L. Qiu <david@qiu.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chat input box styling is broken with long messages
2 participants