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

Skip to content

Conversation

@mayagbarnes
Copy link
Collaborator

@mayagbarnes mayagbarnes commented Apr 1, 2025

Describe your changes

Update st.html to better handle the case of <style> tags with no rendered content.

  • Utilize event container: Styles are now separately passed to the event container (which already has "display: none" for rendering) so they don't impact the layout/flow of the app which causes flickering. Other html content is still handled the same - rendered in the main/sidebar containers
  • Remove .stHtml-empty: Remove check in Html.tsx for dispalyed content & remove .stHtml-empty styling logic on parent element container
  • Add automatic style tag wrapping for .css files

GitHub Issue Link (if applicable)

Closes #9388
Closes #10027

Testing Plan

  • Unit Tests: ✅ Python tests added
  • E2E Tests: ✅ Added & updated
  • Manual Testing: ✅

@mayagbarnes mayagbarnes 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 Apr 1, 2025
@snyk-io
Copy link
Contributor

snyk-io bot commented Apr 1, 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 Apr 1, 2025

✅ PR preview is ready!

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

@mayagbarnes mayagbarnes added change:feature PR contains new feature or enhancement implementation and removed change:feature PR contains new feature or enhancement implementation labels Apr 4, 2025
@mayagbarnes mayagbarnes changed the title [WIP] [Fix] Refactor st.html for style tags [Fix] Refactor st.html for style tags Apr 4, 2025
@mayagbarnes mayagbarnes marked this pull request as ready for review April 4, 2025 22:24
@pmareke
Copy link

pmareke commented Apr 7, 2025

Hi @mayagbarnes first and foremost, thanks for the PR!!!

I was looking from something related with the st.html element as is not included in the AppTest class and I've just found you PR.

Would you mind to include in it the addition of the element in the PR? I think is an easy change (add the new element in the ElementTree class.

I understand that this request is out of the scope of the PR so don't worry if you prefer not to do it!

@mayagbarnes
Copy link
Collaborator Author

Hi @pmareke! Happy to look into adding st.html to AppTest framework (not super familiar with it at this point, so will look into requirements / add as separate PR)

Copy link
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco left a comment

Choose a reason for hiding this comment

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

Thanks for addressing those additional cases. LGTM!

@mayagbarnes mayagbarnes merged commit 1230d0d into develop Apr 9, 2025
34 checks passed
@mayagbarnes mayagbarnes deleted the fix-html branch April 9, 2025 04:50
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.

Add a parameter to st.html to define a wrapper tag App flickers when st.html doesn't contain any visible content (e.g. only CSS)

4 participants