Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sfc-gh-lwilby
Copy link
Collaborator

Describe your changes

GitHub Issue Link (if applicable)

fixes #12435

Testing Plan

  • 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-lwilby sfc-gh-lwilby added security-assessment-completed Security assessment has been completed for PR change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Sep 10, 2025
@snyk-io
Copy link
Contributor

snyk-io bot commented Sep 10, 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
Contributor

github-actions bot commented Sep 10, 2025

✅ PR preview is ready!

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

@sfc-gh-lwilby sfc-gh-lwilby marked this pull request as ready for review September 10, 2025 13:38
with st.container(
horizontal_alignment="center", key="container-horizontal-centered-elements"
):
img: npt.NDArray[np.int_] = np.repeat(0, 10000).reshape(100, 100)
Copy link
Contributor

Choose a reason for hiding this comment

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

The type annotation npt.NDArray[np.int_] violates Python Guide typing requirements. Use typing_extensions for back-porting newer typing features and add from __future__ import annotations. Additionally, np.int_ is deprecated in newer numpy versions and should be replaced with specific integer types like np.int64.

Spotted by Diamond (based on custom rule: Python Guide)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@lukasmasuch lukasmasuch requested a review from Copilot September 11, 2025 17:35
Copy link
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 the horizontal alignment of st.image elements within vertical containers by adjusting how the image container width is handled in the frontend layout system.

  • Removes imgs from the width stretch override list and adds specific handling for image elements
  • Adds specific width handling for arrowDataFrame elements with useContent configuration
  • Adds E2E test coverage for centered elements in containers including images and dataframes

Reviewed Changes

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

File Description
frontend/lib/src/components/core/Block/StyledElementContainerLayoutWrapper.tsx Removes imgs and arrowDataFrame from width stretch override, adds specific width handling logic for both element types
e2e_playwright/st_layouts_container_alignment_test.py Adds test case for container with horizontally centered elements
e2e_playwright/st_layouts_container_alignment.py Adds test container with centered image, dataframe, and button elements

Copy link
Collaborator

@lukasmasuch lukasmasuch 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-lwilby sfc-gh-lwilby merged commit 4954237 into develop Sep 11, 2025
38 checks passed
@sfc-gh-lwilby sfc-gh-lwilby deleted the fix/alignment-images-vertical-container branch September 11, 2025 18:03
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 security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

st.image in st.container with horizontal_alignment is always left-aligned

3 participants