Skip to content

Checkbox display state mismatch #1261

@beeb

Description

@beeb

Summary

When using checkboxes to hide or show sections of the app, a change in the first checkbox will mess with subsequent checkboxes in terms of their display state (they lose their "checked" state if any)

Steps to reproduce

With the MWE below:

  • Run the app
  • Check the "Third checkbox"
  • Then, check the "First checkbox"
  • The "Third checkbox" reverted to unchecked, although the corresponding write is still shown
import streamlit as st

first = st.checkbox('First checkbox')
if first:
    st.write('First is checked')

second = st.checkbox('Second checkbox')
if second:
    st.write('Second is checked')

third = st.checkbox('Third checkbox')
if third:
    st.write('Third is checked')

Expected behavior:

The third checkbox should keep it's "checked" state when box 1 is clicked

Actual behavior:

The third checkbox is shown as "unchecked" even though it's value is True since the text is shown.

streamlit-test-2020-03-26-14-03-13 webm

Is this a regression?

Not sure

Debug info

  • Streamlit version: 0.56.0
  • Python version: 3.7.7
  • Using Conda? yes
  • OS version: macOS Cataline 10.15.3
  • Browser version: Chrome 80.0.3987.149

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions