Py.Cafe

kecnry/

bug-details

minimal example for bug in multiple details elements

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import solara

show_second = solara.reactive(False)

@solara.component
def Page():
    if show_second.value:
        with solara.Details("Originally hidden", expand=False):
            solara.Text("content for originally hidden")
    with solara.Details("Originally visible", expand=False):
        solara.Text("content for originally visible")


    solara.Button(label="toggle 'originally hidden'", on_click=lambda: show_second.set(not show_second.value))

    solara.Text("manually open the 'originally visible' details component, then click button to toggle the entry a.")
    solara.Text("expectation: 'originally hidden' should not be expanded, 'originally visible' should")
    solara.Text("if state is needed to control expand, then I would instead expect all to revert to the passed expand=False")
    solara.Text("actual behavior: 'originally hidden' expands, but the manually opened 'originally visible' collapses")