-
Notifications
You must be signed in to change notification settings - Fork 4k
Add Markdown support to st.dialog title
#11763
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
Conversation
🎉 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) |
✅ PR preview is ready!
|
st.dialog titlest.dialog title
| isCaption: boolean | ||
| isInSidebarOrDialog: boolean | ||
| isLabel?: boolean | ||
| isDialogTitle?: boolean |
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.
I'm not a huge fan of adding isDialogTitle here just because we already have so many different flags + it becomes pretty messy to set the styles below. But every alternative would require a bigger refactoring in my eyes, which should probably be done separately.
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.
Note that we can't use isLabel because it would overwrite the font size and weight of the dialog title.
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.
Hmm, maybe an alternative is a new a bit more generic inheritFont flag, which makes sure that it inherits all relevant font settings. And then we can use isLabel(to restrict some features) + inheritFont to make sure that the parent font settings are used.
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.
Hm yeah that's a good idea. It's still not great and we should definitely refactor this at some point, but maybe good enough for now.
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.
Implemented ✅
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.
Yep, markdown got quite messy over time :(
st.dialog titlest.dialog title
sfc-gh-lmasuch
left a comment
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.
LGTM 👍
|
|
||
|
|
||
| @st.dialog( | ||
| "This is a very long dialog title that should not overlap with the close button" |
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.
nit: not super necessary since markdown_features should do the job, but you could place a few markdown elements in this long title
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.
Yeah I thought about this but wanted to keep it out so it's clear why it fails.
Describe your changes
Allow using Markdown in the
titleofst.dialog. This uses the same restrictions as Markdown labels, i.e. certain elements like tables or bullet points are not allowed.Also fixes an issue where long dialog titles can touch the X icon on the right side by adding a right margin to the title:
GitHub Issue Link (if applicable)
Closes #11755
Testing Plan
st.dialogto the e2e tests for Markdown features.Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.