feat: hide foreground webapp when switching sidebar pages

This commit is contained in:
2026-08-16 20:27:17 +08:00
parent 7a28e2372c
commit fe2dcabdd4
4 changed files with 30 additions and 0 deletions
+9
View File
@@ -24,6 +24,15 @@ const router = {
this.current = id;
document.querySelectorAll('[data-page]').forEach(el =>
el.classList.toggle('active', el.dataset.page === id));
// 切页时把前台 webapp 丢到后台(隐藏内容 WebView,标签状态保留)
// Hide the foreground webapp when switching pages (keep tab state)
bridge.call('hideWebApps').catch(() => {});
// 同时隐藏 webapp 顶栏与标签面板(离开 webapp 场景)
// Also hide the webapp topbar and tab panel (leaving the webapp context)
const topbar = document.getElementById('web-topbar');
if (topbar) topbar.style.display = 'none';
const tabPanel = document.getElementById('tab-panel');
if (tabPanel) tabPanel.style.display = 'none';
// 非首页时侧边栏顶部显示小时间(容器始终占位,仅切换可见性避免撑动图标)
// Show the small clock at the sidebar top when not on home (the container
// always occupies space; only toggle visibility to avoid shifting icons)