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.sidebar expand button is not clickable with latest Streamlit version 1.38 #26

Open
4 tasks done
ryantenerowicz opened this issue Sep 6, 2024 · 8 comments · May be fixed by #29
Open
4 tasks done

st.sidebar expand button is not clickable with latest Streamlit version 1.38 #26

ryantenerowicz opened this issue Sep 6, 2024 · 8 comments · May be fixed by #29
Labels
bug Something isn't working

Comments

@ryantenerowicz
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

After updating my environment to Streamlit 1.38. The st.sidebar button is no longer compatible with streamlet-navigation-bar, and cannot be clicked.

Reproducible code example

"""
Using streamlit==1.38.0
"""

import streamlit as st
from streamlit_navigation_bar import st_navbar

st.set_page_config(initial_sidebar_state='expanded')

page = st_navbar(pages=["Home", "Documentation", "Examples", "Community", "About"],
                 adjust=True,
                 options={'show_sidebar': True})
with st.sidebar:
    st.write('test')

st.write(page)

Steps to reproduce

  1. Update Streamlit to 1.38.0
  2. Run code provided.

Expected behavior

I expect that the sidebar can be expanded and collapsed via the sidebar button.

Current behavior

I tested it with versions <=1.37 and it works perfectly. The bug seems to come from the css styling done by streamlit-navigation-bar. I noticed in 1.38 Streamlit changed the data-testids of some of their components so that broke the CSS styling.

It looks like in the the streamlet-navigation-bar files are using div[data-testid="collapsedControl"] but now in 1.38, Streamlit changed the name of the sidebar button to div[data-testid="stSidebarCollapseButton"]. So I think updating the data-testid should fix the issue.

I attached a video of the bug as well.

sidebar_bug.mov

Is this a regression?

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

Debug info

  • Streamlit version: 1.38
  • Streamlit Navigation Bar version: 3.3.0
  • Python version: 3.9.12
  • Operating System: MacOS
  • Browser: Safari

Additional information

No response

@ryantenerowicz ryantenerowicz added the bug Something isn't working label Sep 6, 2024
@iagofabretti
Copy link

I have the same problem

@50698948
Copy link

50698948 commented Oct 2, 2024

I have the same issue when using streamlit 1.38 version.

@rikonaka
Copy link

rikonaka commented Oct 14, 2024

I have the same issue when using streamlit 1.39.0 version. And I found that streamlit support native navigation bar now https://docs.streamlit.io/develop/api-reference/navigation/st.navigation .

hansthen added a commit to hansthen/streamlit-navigation-bar that referenced this issue Oct 27, 2024
Used both the old and new classnames in the selectors
hansthen added a commit to hansthen/streamlit-navigation-bar that referenced this issue Oct 27, 2024
I noticed that the top: 0 value was outside the viewport. Playing
with the top value, I could replicate the correct location.
However, removing the margin line solved the issue.

Closes issue gabrieltempass#26.
@ryantenerowicz
Copy link
Author

Thanks @hansthen for the fix! @gabrieltempass if you have the change to merge this to main it would be a huge help!

Thanks again for making this component has been so helpful.

@hansthen
Copy link

I made a new package streamlit-community-navigation-bar on pypi. This contains the latest fixes. It is hosted on github under the streamlit-community organization. I hope this can become a place where abandoned streamlit components can be salvaged.

@ryantenerowicz
Copy link
Author

@hansthen would you mind sending the link? I can't seem to find it. Thanks!

@hansthen
Copy link

hansthen commented Nov 4, 2024

@hansthen would you mind sending the link? I can't seem to find it. Thanks!

pip install streamlit-community-navigation-bar works for me.

https://pypi.org/project/streamlit-community-navigation-bar/

Github repo is here: https://github.com/streamlit-community/streamlit-navigation-bar. If you want to volunteer I can send you an invitation to join the organization.

@ryantenerowicz
Copy link
Author

Happy to volunteer! @hansthen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
5 participants