✨ 优化发送记录详情无障碍与抽屉滚动锁

提升发送记录详情在移动端和键盘操作下的可用性,并避免抽屉或详情弹层打开时背景页面滚动。

- 增加详情弹层的焦点管理、Tab 循环、Escape 关闭与焦点返回
- 保留长文件名完整可见,强化复制按钮与关闭按钮的无障碍标签和触控尺寸
- 提取支持嵌套计数与卸载恢复的 body 滚动锁,应用于详情弹层和侧边抽屉
- 已完成 git diff --check;类型检查因依赖未安装而无法运行
This commit is contained in:
orion committed 2026-09-11 08:48:22 +08:00
1 parent c2f0bf1675
commit 5ffee48d80
3 files changed
+80 -14

No files matched your search

+5 -1
View File
@@ -46,9 +46,10 @@
</template>
<script setup lang="ts">
import { inject, nextTick, ref, watch } from 'vue'
import { inject, nextTick, onBeforeUnmount, ref, watch } from 'vue'
import { XIcon } from 'lucide-vue-next'
import { useI18n } from 'vue-i18n'
import { lockBodyScroll, unlockBodyScroll } from './scrollLock'
const props = defineProps<{ visible: boolean; title: string }>()
const emit = defineEmits<{ close: [] }>()
@@ -83,17 +84,20 @@ watch(
() => props.visible,
async (visible) => {
if (visible) {
lockBodyScroll()
returnFocusElement = document.activeElement instanceof HTMLElement ? document.activeElement : null
await nextTick()
const first = drawerRef.value?.querySelector<HTMLElement>(focusableSelector)
;(first || drawerRef.value)?.focus()
} else {
unlockBodyScroll()
await nextTick()
returnFocusElement?.focus()
returnFocusElement = null
}
}
)
onBeforeUnmount(() => unlockBodyScroll())
</script>
<style scoped>