fix: 将侧栏提示层移到导航外侧

将桌面折叠侧栏的 NPopover 显式挂载到 body,并把提示框完整偏移到 64px 导航边界之外。
This commit is contained in:
GouJ
2026-09-09 10:49:10 +08:00
committed by GitHub
parent c2639ca7af
commit 826e3bfa0f
3 changed files with 58 additions and 28 deletions
+25 -25
View File
@@ -1,42 +1,41 @@
# Design QA
- Source visual truth: `/workspace/scratch/6e52996114b8/upload/6c29987c-43a6-4ded-ba86-b66d1c638f51.png`
- Source pixel dimensions: `151 × 506`.
- Browser-rendered implementation: `/workspace/scratch/6e52996114b8/sidebar-popover-pc-final-20260909.jpg`
- Source visual truth: `/workspace/scratch/6e52996114b8/upload/28e7be72-5b24-4b86-bae5-d0d4eb1015e2.png`
- Source pixel dimensions: `151 × 381`.
- Browser-rendered implementation: `/workspace/scratch/6e52996114b8/sidebar-popover-outside-20260909.jpg`
- Browser-rendered implementation dimensions: `1363 × 936`.
- Focused side-by-side comparison: `/workspace/scratch/6e52996114b8/sidebar-popover-comparison-final-20260909.jpg`
- Focused side-by-side comparison: `/workspace/scratch/6e52996114b8/sidebar-popover-outside-comparison-20260909.jpg`
- Implementation CSS viewport: `1363 × 936`, device scale factor `1`.
- State: PC dark theme, collapsed sidebar, pointer hovering the disabled “视觉风格” icon.
## Full-view comparison evidence
The implementation preserves the existing collapsed sidebar width, icon order, selected state and main-content boundary. Hovering an icon opens a compact Naive UI popover to the right without shifting the sidebar or content.
The browser render keeps the `64px` collapsed navigation rail unchanged. The visible popover is teleported to `body`, rendered above the content layer, and no longer begins inside the sidebar boundary.
## Focused region comparison evidence
The focused comparison places the supplied sidebar crop beside a `320 × 506` crop of the browser render. The source icon spacing, dark surfaces and green selected state remain unchanged. The implementation adds the requested hover label beside the icon; disabled workflow items use the explanatory suffix “(剧本完成后可用)”.
The focused comparison places the supplied crop beside a `320 × 381` crop of the revised browser render. The source's red annotation identifies the content-side area beside the collapsed rail. Browser geometry confirms the sidebar ends at `x = 64px` and the popover body begins at `x = 65px`, leaving the body fully outside the sidebar while its arrow still points back to the icon.
## Required fidelity surfaces
- Typography: the application typography is unchanged; popover copy uses the current Naive UI theme and compact UI text sizing.
- Spacing and layout rhythm: the `64px` collapsed sidebar and existing vertical menu rhythm are preserved. Popovers use `placement="right"` and do not alter document flow.
- Colors and visual tokens: dark sidebar surfaces and the selected green state remain unchanged. Popovers inherit the existing dark Naive UI theme.
- Image and asset fidelity: no raster assets were introduced. Existing Lucide menu icons are preserved.
- Copy and content: PC hints use each menu's existing label. Locked entries append “(剧本完成后可用)”; “后端连接” keeps its original copy.
- Typography: existing application and Naive UI popover typography are unchanged.
- Spacing and layout rhythm: the `64px` sidebar and icon rhythm remain unchanged. The popover's total inline-start margin is `24px`, producing a measured `1px` gap outside the sidebar edge.
- Colors and visual tokens: dark surfaces, selected green state and popover theme tokens remain unchanged.
- Image and asset fidelity: no raster or icon assets were added or modified.
- Copy and content: menu labels and locked-state explanation remain unchanged.
## Findings
- No actionable P0/P1/P2 visual or responsive issues remain.
- The disconnected local backend produces the expected in-page `502` response; it does not affect sidebar layout or popover behavior.
- The disconnected local backend produces the expected in-page `502` response; it does not affect popover positioning.
## Primary interactions tested
- Collapsed the PC sidebar and hovered an enabled menu icon; “我的剧本” appeared.
- Hovered the disabled “视觉风格” icon; its availability explanation appeared.
- Hovered the bottom settings icon; “后端连接” appeared.
- Clicked an enabled collapsed icon and confirmed navigation to the target workflow route.
- Expanded the PC sidebar and confirmed menu popovers were absent.
- Confirmed through component tests that mobile navigation does not render menu popovers.
- Collapsed the PC sidebar and hovered the “视觉风格” icon.
- Confirmed the popover content remained readable and the arrow still targeted the icon.
- Measured the sidebar and popover body bounds to confirm the popover starts outside the sidebar.
- Confirmed the popover is explicitly mounted to `body` with a high overlay level.
- Confirmed component tests continue to cover desktop-only popover rendering.
## Console errors checked
@@ -44,15 +43,16 @@ No application-origin console errors were reported. The cloud browser logged onl
## Comparison history
- Iteration 1: added native NPopover wrappers and found that the full-width transparent RouterLink intercepted hover on enabled menu icons.
- Iteration 2: made enabled collapsed icons direct RouterLinks, raised their trigger layer above the transparent label and rechecked enabled, disabled and settings hints in the browser.
- Iteration 1: the popover body began at `x = 51px` while the sidebar ended at `x = 64px`, leaving a `13px` overlap (P2).
- Fix: mounted the popover explicitly to `body`, raised its overlay level, and overrode Naive UI's default inline margin in the component style.
- Iteration 2: the revised browser render measured the popover body at `x = 65px`, a `1px` gap outside the sidebar edge, with no remaining P0/P1/P2 issue.
## Implementation checklist
- [x] Add NPopover hints to all PC collapsed sidebar menu icons.
- [x] Preserve click navigation for enabled collapsed icons.
- [x] Explain locked workflow items in their hint copy.
- [x] Keep PC expanded and mobile navigation free of duplicate popovers.
- [x] Preserve sidebar size, spacing, theme and selected state.
- [x] Place the PC sidebar popover outside the collapsed rail.
- [x] Keep the arrow aligned with the hovered icon.
- [x] Prevent business content from covering the popover.
- [x] Keep existing sidebar spacing, colors, icons and copy.
- [x] Preserve desktop-only popover behavior.
final result: passed