Skip to content

AI-native design editor. Open-source Figma alternative.

fix(a11y): add accessible names to icon-only buttons

Danila Poyarkov965f206991a5
diff --git a/src/components/LayerTree/LayerTreeActions.vue b/src/components/LayerTree/LayerTreeActions.vue
index c0bafe810..dc46ffbd1 100644
--- a/src/components/LayerTree/LayerTreeActions.vue
+++ b/src/components/LayerTree/LayerTreeActions.vue
@@ -40,6 +40,7 @@ const visibilityStyles = computed(() => layerTree({ actionActive: !node.visible
<button
type="button"
data-slot="action"
+ :aria-label="node.locked ? t.unlock : t.lock"
:class="styles.action({ class: ui?.action })"
@pointerdown.stop
@click.stop="emit('toggleLock')"
@@ -60,6 +61,7 @@ const visibilityStyles = computed(() => layerTree({ actionActive: !node.visible
<button
type="button"
data-slot="action"
+ :aria-label="node.visible ? t.hide : t.show"
:class="styles.action({ class: ui?.action })"
@pointerdown.stop
@click.stop="emit('toggleVisibility')"
diff --git a/src/components/Shell/AppMenu.vue b/src/components/Shell/AppMenu.vue
index fc349c90f..4d59d9406 100644
--- a/src/components/Shell/AppMenu.vue
+++ b/src/components/Shell/AppMenu.vue
@@ -80,6 +80,7 @@ const subMenuCls = useMenuUI({ content: 'min-w-44' })
<Tip :label="`${t.toggleUI} (${appMenuShortcutLabel('toggle-ui')})`">
<button
data-test-id="app-toggle-ui"
+ :aria-label="t.toggleUI"
class="flex size-6 shrink-0 cursor-pointer items-center justify-center rounded text-muted transition-colors hover:bg-hover hover:text-surface"
@click="store.state.showUI = !store.state.showUI"
>
diff --git a/src/components/Toolbar/DesktopToolbar.vue b/src/components/Toolbar/DesktopToolbar.vue
index 44ccad428..536cec465 100644
--- a/src/components/Toolbar/DesktopToolbar.vue
+++ b/src/components/Toolbar/DesktopToolbar.vue
@@ -57,6 +57,7 @@ function activeKeyForTool(tool: EditorToolDef) {
<ToolButton
:data-test-id="toolbarToolTestId(tool.key)"
:icon="toolIcons[tool.key]"
+ :label="toolLabels[tool.key]"
:active="active || isActive(tool)"
:ui="ui"
@click="actions.select"
diff --git a/src/components/Toolbar/ToolButton.vue b/src/components/Toolbar/ToolButton.vue
index 5a4913611..83454a2de 100644
--- a/src/components/Toolbar/ToolButton.vue
+++ b/src/components/Toolbar/ToolButton.vue
@@ -9,12 +9,13 @@ import type { ToolbarUI } from '@/components/Toolbar/types'
interface ToolButtonProps {
icon: Component
+ label?: string
active?: boolean
mobile?: boolean
ui?: ToolbarUI
}
-const { icon, active = false, mobile = false, ui } = defineProps<ToolButtonProps>()
+const { icon, label, active = false, mobile = false, ui } = defineProps<ToolButtonProps>()
const toolbar = tv(toolbarTheme)
const styles = computed(() => toolbar({ active, mobile }))
@@ -27,6 +28,7 @@ const emit = defineEmits<{
<button
:data-active="active || undefined"
:data-mobile="mobile || undefined"
+ :aria-label="label"
:class="styles.button({ class: ui?.button })"
@click="emit('click')"
>
diff --git a/src/components/Toolbar/ToolFlyout.vue b/src/components/Toolbar/ToolFlyout.vue
index 2335efcb9..6555499e4 100644
--- a/src/components/Toolbar/ToolFlyout.vue
+++ b/src/components/Toolbar/ToolFlyout.vue
@@ -78,6 +78,7 @@ function flyoutItemClass(subActive: boolean) {
<ToolButton
:data-test-id="toolbarToolTestId(activeKeyForTool(), mobile)"
:icon="toolIcons[activeKeyForTool()]"
+ :label="toolLabels[activeKeyForTool()]"
:active="triggerActive"
:mobile="mobile"
:ui="ui"
@@ -91,6 +92,7 @@ function flyoutItemClass(subActive: boolean) {
v-test-id="toolbarFlyoutTestId(tool.key, mobile)"
:data-active="triggerActive || undefined"
:data-mobile="mobile || undefined"
+ :aria-label="`${toolLabels[tool.key]} options`"
:class="styles.flyoutTrigger({ class: ui?.flyoutTrigger })"
>
<IconChevronDown :class="styles.flyoutTriggerIcon({ class: ui?.flyoutTriggerIcon })" />