🐛 fix: 固定存储卡片悬浮命中区域与移动行为

* 固定外层命中区域、内层负责位移及颜色阴影过渡,保持 2px 效果
* 为减少动画与触屏禁用位移,补充命中区域回归测试,83 项测试及构建通过
This commit is contained in:
orion committed 2026-10-29 17:22:34 +08:00
1 parent d903dc3f3f
commit 00bba28b5d
2 files changed
+37 -8

No files matched your search

+28 -8
View File
@@ -1409,16 +1409,20 @@
<div
v-for="item in detailStorageItems"
:key="item.label"
class="fcb-storage-card theme-2026-card-hover grid gap-1 rounded-[22px] border px-3 py-2.5 shadow-md transition-all duration-200 hover:shadow-lg sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center"
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-white']"
class="fcb-storage-hitbox"
>
<p class="text-xs leading-4" :class="[mutedTextClass]">{{ item.label }}</p>
<p
class="break-all text-sm font-medium leading-5"
:class="[item.mono ? 'font-mono' : '', primaryTextClass]"
<div
class="fcb-storage-card theme-2026-card-hover grid gap-1 rounded-[22px] border px-3 py-2.5 shadow-md transition-all duration-200 hover:shadow-lg sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center"
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-white']"
>
{{ item.value }}
</p>
<p class="text-xs leading-4" :class="[mutedTextClass]">{{ item.label }}</p>
<p
class="break-all text-sm font-medium leading-5"
:class="[item.mono ? 'font-mono' : '', primaryTextClass]"
>
{{ item.value }}
</p>
</div>
</div>
</div>
</section>
@@ -2574,6 +2578,22 @@ onUnmounted(() => {
background-color 300ms ease, border-color 300ms ease !important;
}
.fcb-storage-hitbox:hover .fcb-storage-card {
transform: translateY(-2px) !important;
background: #f0f4f8 !important;
box-shadow: var(--fcb-card-shadow-hover) !important;
}
.dark .fcb-storage-hitbox:hover .fcb-storage-card {
background: #2f414a !important;
}
@media (prefers-reduced-motion: reduce), (hover: none) {
.fcb-storage-hitbox:hover .fcb-storage-card {
transform: none !important;
}
}
@media (prefers-reduced-motion: reduce) {
.fcb-storage-card { transition-duration: 0.01ms !important; }
}
+9
View File
@@ -119,3 +119,12 @@ test('storage detail cards animate visual properties without transitioning grid
assert.ok(!/\ball\b/.test(transition))
for(const property of ['transform','box-shadow','background-color','border-color'])assert.ok(transition.includes(property))
})
test('storage card hover uses a stationary wrapper and disables movement for touch or reduced motion', async () => {
const {descriptor}=parse(readFileSync('src/views/manage/FileManageView.vue','utf8'))
const content=descriptor.template.content
assert.match(content,/v-for="item in detailStorageItems"[\s\S]*?class="fcb-storage-hitbox"[\s\S]*?<div\s+class="fcb-storage-card/)
const css=descriptor.styles.map(s=>s.content).join('\n')
assert.match(css,/\.fcb-storage-hitbox:hover\s+\.fcb-storage-card[\s\S]*?translateY\(-2px\)/)
assert.match(css,/@media \(prefers-reduced-motion: reduce\), \(hover: none\)/)
})