Skip to content

[fix] File Upload Drop Target truncates subtext#12192

Merged
sfc-gh-bnisco merged 9 commits into
developfrom
bnisco/fix-12189
Aug 13, 2025
Merged

[fix] File Upload Drop Target truncates subtext#12192
sfc-gh-bnisco merged 9 commits into
developfrom
bnisco/fix-12189

Conversation

@sfc-gh-bnisco
Copy link
Copy Markdown
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco commented Aug 12, 2025

Describe your changes

GitHub Issue Link (if applicable)

Fixes #12189

Testing Plan

  • ✅ Adds e2e tests

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@sfc-gh-bnisco sfc-gh-bnisco requested a review from Copilot August 12, 2025 23:25
@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io Bot commented Aug 12, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Aug 12, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12192/streamlit-1.48.1-py3-none-any.whl
🕹️ Preview app pr-12192.streamlit.app (☁️ Deploy here if not accessible)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a regression where the file uploader's subtext (file type instructions) would truncate improperly instead of showing ellipsis when the content was too long to fit the available space.

  • Adds CSS properties to enable proper text truncation with ellipsis for overflowing subtext
  • Wraps the browse button in a container to prevent it from wrapping when space is constrained
  • Adds an E2E test case with many file types to verify the fix works correctly

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
frontend/lib/src/components/widgets/FileUploader/styled-components.ts Adds CSS properties for proper text truncation and flex layout constraints
frontend/lib/src/components/widgets/FileUploader/FileDropzone.tsx Wraps the browse button in a no-wrap container
e2e_playwright/st_file_uploader.py Adds test case with many file types to reproduce the truncation scenario
e2e_playwright/st_file_uploader_test.py Updates test expectations to include the new test case

@sfc-gh-bnisco sfc-gh-bnisco added security-assessment-completed change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Aug 12, 2025
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

note: It is expected that only the Chromium screenshots for these tests are updated because of the scrollbar gutter differing between Chromium and FF and Webkit.

In FF and Webkit, there is enough space such that the text in the File Uploader all fits on one line: https://github.com/streamlit/streamlit/blob/develop/e2e_playwright/__snapshots__/linux/custom_theme_test/custom_themed_app%5Bfirefox%5D.png

height: "auto",
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: Replace 'any' with a more specific type.
[StyledFileDropzoneInstructions as any]: {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

note: I simplified this by using gap instead of manually managing padding

@sfc-gh-bnisco sfc-gh-bnisco marked this pull request as ready for review August 13, 2025 19:48
Comment thread e2e_playwright/st_file_uploader.py Outdated
Copy link
Copy Markdown
Contributor

@sfc-gh-nbellante sfc-gh-nbellante left a comment

Choose a reason for hiding this comment

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

LGTM

@sfc-gh-bnisco sfc-gh-bnisco merged commit 8842983 into develop Aug 13, 2025
37 checks passed
@sfc-gh-bnisco sfc-gh-bnisco deleted the bnisco/fix-12189 branch August 13, 2025 20:24
@streamlit streamlit deleted a comment from confrontedp Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Layout issue in file_uploader

3 participants