[fix] Increase max width of uploaded files in st.chat_input#13589
[fix] Increase max width of uploaded files in st.chat_input#13589sfc-gh-nbellante merged 4 commits intodevelopfrom
st.chat_input#13589Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
st.chat_input
There was a problem hiding this comment.
Pull request overview
This PR aims to fix file name truncation in st.chat_input by increasing the maximum width of uploaded file components from 11rem to 100%.
Changes:
- Increased
maxWidthfrom11remto100%inStyledChatUploadedFilestyled component
Comments suppressed due to low confidence (1)
frontend/lib/src/components/widgets/ChatInput/fileUpload/styled-components.ts:82
- The change to
maxWidth: "100%"does not achieve the stated goal of making filenames fully visible. ThetruncateFilename()function (intruncateFilename.ts) still truncates filenames to 16 characters with middle ellipsis (e.g., "very-...me.pdf"). To properly show full filenames without truncation, either remove the JavaScript truncation logic inChatUploadedFile.tsxline 181, or increase themaxLengthparameter passed totruncateFilename(). The current change will make file chips grow wider but filenames will still be truncated by JavaScript, not CSS. Consider whether the goal is to: (1) allow file chips to expand to show the full truncated text without CSS clipping, or (2) remove truncation entirely to show complete filenames.
maxWidth: "100%",
sfc-gh-bnisco
left a comment
There was a problem hiding this comment.
Can you please add some type of test to cover this behavior? A snapshot test seems like the best test type for this particular case.
I believe there are snapshot tests but they didn't change because the JS truncation was already keeping it under the 11rem limit. We just happened to discover an example at office hours today where it's short enough to pacify the JS truncation but not short enough to pacify the CSS one. |
frontend/lib/src/components/widgets/ChatInput/fileUpload/styled-components.ts
Show resolved
Hide resolved
05ed8ef to
73515df
Compare

Describe your changes
Increased the maximum width of uploaded file components from
11remto100%to ensure that file names are fully visible and not truncated with css.Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.