feat: use <button> to improve a11y and keyboard navigation experience (#74)

This commit is contained in:
George Chen
2025-01-12 01:35:19 +08:00
committed by GitHub
parent 11283f6f94
commit 78fa350ced
9 changed files with 28 additions and 16 deletions

View File

@@ -16,21 +16,21 @@ function clearAllHistory() {
<template>
<div pt-2>
<div
<button
text="blue-900 dark:blue-200"
bg="blue-300 op-20 hover:(blue-800 op-20) dark:hover:(blue-200 op-20)"
class="inline-flex items-center justify-center border border-transparent rounded-md px-4 py-2 text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500"
@click="clearAllHistory"
>
<div i-ri-eraser-line />
<span i-ri-eraser-line />
<span class="ml-1">清空记录</span>
</div>
</button>
<div flex="~ col">
<div v-for="history in recipeHistories" :key="history.recipe.name" mt-2>
<StapleTag :active="false">
<DateTag>
{{ dayjs(history.time).format('YYYY-MM-DD HH:mm:ss') }}
</StapleTag>
</DateTag>
<DishTag :dish="history.recipe" />
</div>
</div>