Skip to content
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

Dialog boxes don't function when nested inside fragments (fragments inside fragments not supported) #8635

Open
3 of 4 tasks
mzientek opened this issue May 8, 2024 · 4 comments
Labels
feature:st.dialog feature:st.fragment type:enhancement Requests for feature enhancements or new features

Comments

@mzientek
Copy link

mzientek commented May 8, 2024

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

I'm trying to present a dialog box within a fragment, however, when the dialog/modal is nested inside a fragment, it doesn't interact correctly and doesn't close. The content inside the box closes when interacting with it, but the title and the dialog box itself remain open.

Reproducible Code Example

import streamlit as st

@st.experimental_dialog("Test Dialog")
def dialog_box():
    st.markdown("Hello world")
    if st.button("Do something")
        st.markdown("Did it")
    if st.button("Close"):
        st.rerun()

@st.experimental_fragment
def fragment():
    if st.button("Open Dialog"):
        dialog_box() 

fragment()

Steps To Reproduce

  1. Go to "Open Dialog"
  2. Click on either "Do something" or "Close" to observe the behavior.

Expected Behavior

Expected that the dialog box would be able to function within a fragment and that the close and rerun, would in fact close the dialog box.

Current Behavior

No response

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.34.0
  • Python version: 3.9.18
  • Operating System: Ubuntu 20.04
  • Browser: Firefox

Additional Information

No response

@mzientek mzientek added status:needs-triage Has not been triaged by the Streamlit team type:bug Something isn't working labels May 8, 2024
Copy link

github-actions bot commented May 8, 2024

If this issue affects you, please react with a 👍 (thumbs up emoji) to the initial post.

Your feedback helps us prioritize which bugs to investigate and address first.

Visits

@raethlein
Copy link
Collaborator

raethlein commented May 10, 2024

Hey @mzientek, according to our concept docs for fragements in the "Limitations and unsupported behavior" section, we unfortunately right now do not allow nesting fragments inside each other. Since dialog is using fragments under-the-hood, the same applies to dialog. We will look into improving the UX and throw an error or similar to make this clearer! If this behavior will change in the future, we will put it into the respective release notes.

@raethlein raethlein added type:docs Requests for changes to docs (will be rerouted to docs repo) and removed status:needs-triage Has not been triaged by the Streamlit team labels May 10, 2024
@raethlein raethlein changed the title Dialog boxes don't function when nested inside fragments Dialog boxes don't function when nested inside fragments (fragments inside fragments not supported) May 10, 2024
@mzientek
Copy link
Author

Ok, thanks.

@raethlein raethlein added the status:confirmed Bug has been confirmed by the Streamlit team label May 13, 2024
@kmcgrady kmcgrady added type:enhancement Requests for feature enhancements or new features and removed type:bug Something isn't working type:docs Requests for changes to docs (will be rerouted to docs repo) status:confirmed Bug has been confirmed by the Streamlit team labels May 13, 2024
Copy link

To help Streamlit prioritize this feature, react with a 👍 (thumbs up emoji) to the initial post.

Your vote helps us identify which enhancements matter most to our users.

Visits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:st.dialog feature:st.fragment type:enhancement Requests for feature enhancements or new features
Projects
None yet
Development

No branches or pull requests

4 participants