🐛 修复详情披露与滚动锁所有权

修复记录详情中的渐进式二维码与 wget 展示,并确保详情切换时重置披露状态。为滚动锁引入按所有者释放机制,避免重复或错误释放解锁仍打开的抽屉。

- 二维码和 wget 命令默认折叠,改为可操作的显示控件
- 详情关闭按钮保持 44px 触控目标,嵌套对话框 Escape 不穿透
- 增加 scrollLock mocked document 回归测试
- 已通过类型检查、架构检查、生产构建和 Node 测试
This commit is contained in:
orion committed 2026-09-11 08:55:28 +08:00
1 parent 5ffee48d80
commit cd06a5580e
4 files changed
+65 -17

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
import assert from 'node:assert/strict'
import test from 'node:test'
const body = { style: { overflow: 'scroll' } }
globalThis.document = { body }
const { lockBodyScroll, unlockBodyScroll } = await import('../src/components/common/scrollLock.ts')
test('restores overflow only after the owning lock is released', () => {
const first = lockBodyScroll()
const second = lockBodyScroll()
unlockBodyScroll(Symbol('unrelated'))
assert.equal(body.style.overflow, 'hidden')
unlockBodyScroll(first)
assert.equal(body.style.overflow, 'hidden')
unlockBodyScroll(second)
assert.equal(body.style.overflow, 'scroll')
})
test('releasing an owner twice cannot unlock another owner', () => {
const first = lockBodyScroll()
const second = lockBodyScroll()
unlockBodyScroll(first)
unlockBodyScroll(first)
assert.equal(body.style.overflow, 'hidden')
unlockBodyScroll(second)
assert.equal(body.style.overflow, 'scroll')
})