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

Chat input box styling is broken with long messages #796

Closed
krassowski opened this issue May 22, 2024 · 2 comments · Fixed by #877
Closed

Chat input box styling is broken with long messages #796

krassowski opened this issue May 22, 2024 · 2 comments · Fixed by #877
Assignees
Labels
bug Something isn't working
Milestone

Comments

@krassowski
Copy link
Member

Description

When pasting long text into the chat window

  1. The send button disappears from the view
  2. Some odd grey artifact is shown obstructing the view

Reproduce

Paste a long text into the input box, for example paste the following 20 times:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 

styling-issue-with-long-text

Snapshot on the situation using element picker from the Chrome dev tools:

image

Expected behavior

  • the send button is positioned correctly irrespective of height
  • a max height is set on the chat input
  • there is no styling artifacts when long text is inserted

Context

  • Browser and version: Chrome 125
  • JupyterLab version: 4.2.0
  • Extension: 2.1.6
@krassowski krassowski added the bug Something isn't working label May 22, 2024
@dlqqq dlqqq added this to the Priority milestone May 31, 2024
@krassowski krassowski self-assigned this Jul 4, 2024
@krassowski
Copy link
Member Author

Of note, this artifact only occurs in Chromium-based browsers, but not in Firefox. In either Chrome or Firefox the send button becomes inaccessible.

@krassowski
Copy link
Member Author

So this appears to be because of the implementation detail of TextField from mui = when using multiline - it force-sets the height which confuses the flex layout (ref: https://mui.com/material-ui/react-text-field/)

<TextField
{...params}
fullWidth
variant="outlined"
multiline
placeholder="Ask Jupyternaut"
onKeyDown={handleKeyDown}
InputProps={{
...params.InputProps,
endAdornment: (
<InputAdornment position="end">
<SendButton {...sendButtonProps} />
</InputAdornment>
)
}}

The simplest solution is to set maxRows on the TextField. Alternatively, setting overflow: scroll; max-height: 50% on the entire chat input section would help but it would not solve the problem of invisible button. The issue with maxRows solution is that we cannot easily set it to be depend on resolution. Still, doing a custom solution that would fight with the mui would likely not be worth it.

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 a pull request may close this issue.

2 participants