New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix shrunk icon size in st.expander #7596
Conversation
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hey @matiboux Thanks for the contribution and sorry for the delay! Looks like there's some snapshot errors associated with our metric, which uses the icon. I'll get the snapshots updated as they probably look most correct. I'd also like to get an end to end test for the expander to ensure this does not pop up again. |
Thanks! No problem for the delay, I'm happy this is moving forward. Doing some research first: I found resources to help me understand how tests and snapshots can be updated:
Comparing the first metric test snapshot from the CI workflow with |
Hey @matiboux. Yes the easiest way would be to remove the problematic images, push them, let the CI fail, download the correct artifacts, and push them. For the expander. We migrated the tests to use playwright. We are in the process of changing our end to end testing since playwright since we can do screenshot tests in multiple browsers (and it's much faster). You can add an example of an expander with a long amount of text here. https://github.com/streamlit/streamlit/blob/develop/e2e_playwright/st_expander.py You can then add a test to assert the screenshot of expander. https://github.com/streamlit/streamlit/blob/develop/e2e_playwright/st_expander_test.py Like cypress it will fail cause there are missing screenshots, you can then add them (making sure they look right), and then the tests should pass. Let me know if there's any issues. Really appreciate your help! |
So I've finally made the changes.
I tried not to impact existing tests when I added long expanders tests at the end of the existing test page. The existing test screenshot gets cut at the end, so I'm betting what I added below that won't appear either. I added a new test that generates two new screenshots: one for an expanded long expander, and another for a collapsed long expander. |
Hey @kmcgrady, Please review my changes and tell me if you want me to change something else before we can continue. If all is good, the workflow requires your approval for running. 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing the CI results.
Thank you for the approved workflows run. CI results reviewed and corrections applied.
Finally, despite my wrong I'll need a new workflows run to add the missing I'll let you review new changes and approve the workflows run if all seems good. |
@kmcgrady Thank you again. Latest commit adds the missing All checks are now successful! ✅ |
Awesome! Thanks @matiboux! And Happy New Year! Things are looking good here! Thank you so much for your time and patience! If you're happy, I can get this merged today! |
@kmcgrady All good for me as well! |
* Add flexShrink to StyledIcon * Fix the st_metric_test playwright e2e test images * Add test for long expanders * Add trailing comma to fix coding style * Fix main_expanders count assertions * Fix nth values for stExpander-long assertions * Add stExpander-long-collapsed playwright e2e test images * Add missing & move stExpander-long playwright e2e test images
Describe your changes
This PR fixes the expand icon size in
st.expander
.Currently, the icon size is shrunk when the label is a long text. See the current behavior:
This PR adds a change to set the
flex-shrink: 0
CSS property so that all icons look like the first one, even with large text labels.Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.