@@ -73,26 +73,20 @@ def toggle_sidebar():
7373 min-width: 350px !important;
7474 }
7575
76- /* AGGRESSIVELY Hide ALL native header buttons in sidebar */
77- [data-testid="stSidebarCollapsedControl"],
76+ /* Hide ONLY the native toggle button safely */
7877 button[data-testid="stSidebarCollapseButton"],
79- section[data-testid="stSidebar"] button[kind="header"],
80- section[data-testid="stSidebar"] > div:first-child button {
81- display: none !important;
82- opacity: 0 !important;
83- pointer-events: none !important;
84- }
85-
86- /* Hide the top header container of the sidebar entirely if possible to kill the arrow */
87- section[data-testid="stSidebar"] > div:first-child:has(button) {
78+ [data-testid="stSidebarCollapsedControl"],
79+ section[data-testid="stSidebar"] button[kind="header"] {
8880 display: none !important;
81+ visibility: hidden !important;
8982 }
9083 </style>
9184 """ , unsafe_allow_html = True )
9285
9386 # Show a standard "Close Menu" button at the very top of sidebar
9487 with st .sidebar :
95- st .markdown ("<div style='margin-top: -1rem;'></div>" , unsafe_allow_html = True )
88+ # Spacer to push button down slightly from the very top edge
89+ st .markdown ("<div style='margin-top: 0.5rem;'></div>" , unsafe_allow_html = True )
9690 if st .button ("✖ Close Menu" , key = "custom_sidebar_close" , type = "primary" , use_container_width = True ):
9791 toggle_sidebar ()
9892 st .rerun ()
0 commit comments