fix: prevent sidebar collapse from blocking mobile hamburger menu

The `.ev-sidebar-collapsed .VPSidebar { display: none }` rule was not
wrapped in a media query, causing it to hide the sidebar at all viewport
widths. When a user collapsed the sidebar on desktop, the state persisted
in localStorage; resizing below 960px then caused VitePress's native
hamburger menu to open an immediately-hidden sidebar. Wrapping the rule
in `@media (min-width: 960px)` limits the override to desktop only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
yli
2026-02-24 11:50:50 +08:00
parent 7538228113
commit 951541d5c5
2 changed files with 25 additions and 64 deletions
+5 -3
View File
@@ -673,9 +673,11 @@ watch(sidebarCollapsed, (collapsed) => {
/* ---- 收起状态下的 CSS 覆盖 ---- */
/* 隐藏侧边栏 */
.ev-sidebar-collapsed .VPSidebar {
display: none !important;
/* 隐藏侧边栏 — 仅桌面端,避免覆盖移动端的汉堡菜单 */
@media (min-width: 960px) {
.ev-sidebar-collapsed .VPSidebar {
display: none !important;
}
}
/* 内容区域填满页面 */