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

st.toggle gets (de)activated when clicking anywhere in the same row #7244

Open
3 of 4 tasks
flucas96 opened this issue Aug 28, 2023 · 3 comments
Open
3 of 4 tasks

st.toggle gets (de)activated when clicking anywhere in the same row #7244

flucas96 opened this issue Aug 28, 2023 · 3 comments
Labels
feature:st.toggle type:enhancement Requests for feature enhancements or new features

Comments

@flucas96
Copy link

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

Hey everyone,

I am happy to see that the new st.toggle feature got released with version 1.26. Thank you very much for that!!

I just tried it out and noticed that when clicking anywhere in the row where the toggle widget is placed it activates it.

I uploaded a small example of what I mean here:

Streamlit (toggletest.streamlit.app) 5

GIF:

426eba0092839d3fe87330307347bc3a3899798b

Repost from:
https://discuss.streamlit.io/t/streamlit-toggle-in-version-1-26-bug/50118

Reproducible Code Example

import streamlit as st



st.toggle("Switch 1", value=False, key="switch1")


col_left,col_right = st.columns((1,1))
with col_left: 

    st.toggle("Switch left", value=False, key="switch_left")


with col_right:
    st.toggle("Switch right", value=False, key="switch_right")

Steps To Reproduce

  1. Clicking anywhere in the same row a st.toggle button is.

Expected Behavior

When the cursor is not directly above the st.toggle button - clicking anywhere should not change its state.

Current Behavior

Clicking anywhere in the same row activates or deactivates the st.toggle.

Is this a regression?

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

Debug info

  • Streamlit version: 1,27
  • Python version: 3.11
  • Operating System: Windows / Linux / Streamlit Cloud
  • Browser: Edge

Additional Information

No response

@flucas96 flucas96 added status:needs-triage Has not been triaged by the Streamlit team type:bug Something isn't working labels Aug 28, 2023
@github-actions
Copy link

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

@LukasMasuch
Copy link
Collaborator

@flucas96 Thanks for reporting this issue. In the current implementation, this behavior is mostly expected. This is working the same as the st.checkbox implementation. Changing this to enhancement since I think it is a valid consideration to change this behavior for checkbox and toggle.

@LukasMasuch LukasMasuch added type:enhancement Requests for feature enhancements or new features and removed status:needs-triage Has not been triaged by the Streamlit team labels Aug 28, 2023
@streamlit streamlit deleted a comment from github-actions bot Aug 28, 2023
@LukasMasuch LukasMasuch removed the type:bug Something isn't working label Aug 28, 2023
@jandvorak-sol60279
Copy link

i found this issue today. st.toggle clickable is occupying whole box, where is rendered. if you split row into multiple ones, like with columns, it will be clickable only in that part of row, which bellongs to collumn.

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

No branches or pull requests

4 participants