Skip to content

[fix] html with float height. #12354

Merged
lukasmasuch merged 2 commits intodevelopfrom
fix/html-height-with-float
Aug 28, 2025
Merged

[fix] html with float height. #12354
lukasmasuch merged 2 commits intodevelopfrom
fix/html-height-with-float

Conversation

@sfc-gh-lwilby
Copy link
Copy Markdown
Collaborator

@sfc-gh-lwilby sfc-gh-lwilby commented Aug 27, 2025

Describe your changes

The html element has width and height parameters which accept an integer or None. Previously, we had no validation for the type and it was possible to provide a float value. A recent change converted these elements to the new width/height system and as part of that float values were silently ignored and set to the default (stretch).

GitHub Issue Link (if applicable)

Closes #12340

Testing Plan

I didn't add new tests for this because it isn't officially supported.


Contribution License Agreement

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

@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Aug 27, 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 27, 2025

✅ PR preview is ready!

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

@sfc-gh-lwilby sfc-gh-lwilby added security-assessment-completed change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Aug 27, 2025
@sfc-gh-lwilby sfc-gh-lwilby marked this pull request as ready for review August 27, 2025 23:52
@sfc-gh-lmasuch sfc-gh-lmasuch requested a review from Copilot August 28, 2025 09:44
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 bug in the html element where float values for width and height parameters were being silently ignored and set to defaults instead of being converted to integers. The fix ensures float values are properly handled by converting them to integers.

Key Changes

  • Updated width and height validation to accept both int and float types
  • Added explicit conversion of float values to integers for pixel dimensions

Copy link
Copy Markdown
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 👍 I generate a couple of unit tests for layout_utils to cover this aspect.

@lukasmasuch lukasmasuch enabled auto-merge (squash) August 28, 2025 10:00
@lukasmasuch lukasmasuch merged commit 68af47d into develop Aug 28, 2025
36 checks passed
@lukasmasuch lukasmasuch deleted the fix/html-height-with-float branch August 28, 2025 10:21
lukasmasuch added a commit that referenced this pull request Aug 29, 2025
## Describe your changes

The `html` element has width and height parameters which accept an
integer or None. Previously, we had no validation for the type and it
was possible to provide a float value. A recent change converted these
elements to the new width/height system and as part of that float values
were silently ignored and set to the default (stretch).

<!-- If it's a visual change, please include a screenshot or video! -->

## GitHub Issue Link (if applicable)

Closes #12340

## Testing Plan

I didn't add new tests for this because it isn't officially supported.

---

**Contribution License Agreement**

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

---------

Co-authored-by: lukasmasuch <[email protected]>
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.

streamlit.components.v1 height BUG

3 participants