fix(theme): 软导航主题回退——ThemeScript 补 data-astro-rerun
- 病根:ClientRouter 软导航换 html 属性把 data-theme 抹回无主题态, 而内联脚本默认仅首次执行(Astro 规矩:重跑须显式 data-astro-rerun) ——切换明暗后一切栏目即回系统默认(用户实测报告) - 写入端审计:Header/Keyboard t/命令面板/终端四入口均写同一 localStorage key,无第二套实现,病灶唯一 - E2E 补软导航持久断言(原仅测 reload,漏了真实 bug 场景) 验证: node tests/e2e.mjs 31/31 PASS(软导航后=dark 断言新增) Spec: none (线上热修:单属性缺陷 + 回归断言) Co-authored-by: GLM-5.3
This commit is contained in:
1 parent
a10141dfd8
commit
e57c853f20
2 files changed
+11
-3
No files matched your search
@@ -3,7 +3,10 @@
|
||||
// 优先级:用户手选(localStorage) > 系统偏好;切换按钮(T7 键盘/组件)写同一 key。
|
||||
---
|
||||
|
||||
<script is:inline>
|
||||
<script is:inline data-astro-rerun>
|
||||
// data-astro-rerun:ClientRouter 软导航会换 html 属性(data-theme 被新页
|
||||
// 面的无主题态覆盖),内联脚本默认只跑首次——不加重跑标记,切主题后一导航
|
||||
// 就回退系统默认(用户实测报告的 bug)
|
||||
(function () {
|
||||
var saved = localStorage.getItem('theme');
|
||||
var theme = saved === 'light' || saved === 'dark'
|
||||
|
||||
Reference in new issue
Block a user