add aria labels

This commit is contained in:
vcoppe
2024-09-23 16:41:12 +02:00
parent 2e1ead31ea
commit 195671acb6
4 changed files with 75 additions and 72 deletions

View File

@@ -4,6 +4,7 @@
import { currentTool, type Tool } from '$lib/stores';
export let tool: Tool;
export let label: string;
function toggleTool() {
currentTool.update((current) => (current === tool ? null : tool));
@@ -17,11 +18,12 @@
variant="ghost"
class="h-[26px] px-1 py-1.5 {$currentTool === tool ? 'bg-accent' : ''}"
on:click={toggleTool}
aria-label={label}
>
<slot name="icon" />
</Button>
</Tooltip.Trigger>
<Tooltip.Content side="right">
<slot name="tooltip" />
<span>{label}</span>
</Tooltip.Content>
</Tooltip.Root>