04/18 fix toggle button of sidebar

This commit is contained in:
2026-04-18 14:52:25 -04:00
parent 4aca3b2fb9
commit 86d69d7b83
+36 -22
View File
@@ -310,27 +310,39 @@ ul {
display: flex;
flex-direction: column;
overflow: hidden;
overflow-y: auto;
transition: width 0.22s ease;
}
.sidebar.collapsed {
width: 56px;
overflow-y: visible;
}
/* Sidebar must not clip its children when collapsed — tooltips need to escape */
.sidebar.collapsed .sidebar-nav,
.sidebar.collapsed .sidebar-footer {
overflow: visible;
}
.sidebar-header {
display: flex;
align-items: center;
gap: 8px;
padding: 18px 16px;
padding: 14px 12px;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
flex-shrink: 0;
min-height: 60px;
min-height: 56px;
overflow: hidden;
}
/* When collapsed: centre the toggle button, hide everything else */
.sidebar.collapsed .sidebar-header {
justify-content: center;
padding: 14px 0;
overflow: visible;
}
.sidebar-header .logo-icon {
font-size: 22px;
flex-shrink: 0;
transition: opacity 0.15s ease;
}
.sidebar-header .logo-text {
font-size: 16px;
@@ -339,41 +351,45 @@ ul {
flex: 1;
white-space: nowrap;
overflow: hidden;
transition:
opacity 0.15s ease,
width 0.15s ease;
transition: opacity 0.15s ease;
}
.sidebar.collapsed .sidebar-header .logo-icon,
.sidebar.collapsed .sidebar-header .logo-text {
opacity: 0;
width: 0;
pointer-events: none;
}
/* Toggle button */
/* Toggle button — always visible, always clickable */
.btn-sidebar-toggle {
background: none;
border: none;
color: rgba(255, 255, 255, 0.5);
font-size: 13px;
font-size: 14px;
cursor: pointer;
padding: 4px 6px;
padding: 6px 8px;
border-radius: 4px;
line-height: 1;
flex-shrink: 0;
transition:
color var(--transition),
transform 0.22s ease;
margin-left: auto;
z-index: 10;
}
.btn-sidebar-toggle:hover {
color: #fff;
background: rgba(255, 255, 255, 0.1);
background: rgba(255, 255, 255, 0.12);
}
.sidebar.collapsed .btn-sidebar-toggle {
transform: rotate(180deg);
margin-left: 0;
}
.sidebar-nav {
flex: 1;
padding: 8px 0;
overflow-y: auto;
}
.sidebar-section-header {
@@ -389,6 +405,8 @@ ul {
.sidebar.collapsed .sidebar-section-header {
opacity: 0;
pointer-events: none;
height: 0;
padding: 0;
}
.sidebar-item {
@@ -405,6 +423,7 @@ ul {
text-align: left;
position: relative;
white-space: nowrap;
overflow: hidden;
}
.sidebar-item:hover {
background: var(--color-sidebar-hover);
@@ -418,29 +437,24 @@ ul {
flex-shrink: 0;
}
/* Hide labels and show tooltip when collapsed */
/* Labels — fade out when collapsed */
.sidebar-label {
overflow: hidden;
transition:
opacity 0.15s ease,
width 0.15s ease;
transition: opacity 0.15s ease;
}
.sidebar.collapsed .sidebar-label {
opacity: 0;
width: 0;
}
.sidebar.collapsed .sidebar-item {
justify-content: center;
padding: 9px 0;
overflow: visible; /* allow tooltip to escape */
}
/* Tooltip — shown on hover in collapsed state */
.sidebar.collapsed .sidebar-item::after {
content: attr(data-tooltip);
position: absolute;
left: calc(100% + 8px);
top: 50%;
transform: translateY(-50%);
position: fixed;
left: 64px;
background: #111827;
color: #fff;
font-size: 12px;
@@ -450,7 +464,7 @@ ul {
pointer-events: none;
opacity: 0;
transition: opacity 0.12s ease;
z-index: 200;
z-index: 1000;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.sidebar.collapsed .sidebar-item:hover::after {