Skip to content

Commit 2384653

Browse files
committed
voice over toolbar actions
1 parent f9cd0b4 commit 2384653

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

packages/super-editor/src/components/toolbar/ButtonGroup.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,12 @@ const handleFocus = (e) => {
183183
</script>
184184
185185
<template>
186-
<div :style="getPositionStyle" class="button-group" @focus="(e) => handleFocus(e)">
186+
<div
187+
:style="getPositionStyle"
188+
class="button-group"
189+
role="group"
190+
@focus="(e) => handleFocus(e)"
191+
>
187192
<div
188193
v-for="(item, index) in toolbarItems"
189194
:key="item.id.value"

packages/super-editor/src/components/toolbar/ToolbarButton.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ const caretIcon = computed(() => {
9090
<div
9191
:class="['toolbar-item', attributes.className]"
9292
:style="getStyle"
93-
:role="isOverflowItem ? 'menuitem' : ''"
94-
role="button"
93+
:role="isOverflowItem ? 'menuitem' : 'button'"
9594
:aria-label="attributes.ariaLabel"
9695
@click="handleClick"
9796
@keydown.enter.stop="handleClick"
@@ -112,14 +111,15 @@ const caretIcon = computed(() => {
112111
<span v-if="inlineTextInputVisible">
113112
<input v-if="name === 'fontSize'" v-model="inlineTextInput" @input="onFontSizeInput" :placeholder="label"
114113
@keydown.enter.prevent="handleInputSubmit" type="text" class="button-text-input"
115-
:class="{ 'high-contrast': isHighContrastMode }" :id="'inlineTextInput-' + name" autoccomplete="off" ref="inlineInput" />
114+
:class="{ 'high-contrast': isHighContrastMode }" :id="'inlineTextInput-' + name" autocomplete="off" ref="inlineInput" />
116115
<input v-else v-model="inlineTextInput" :placeholder="label" @keydown.enter.prevent="handleInputSubmit"
117-
type="text" class="button-text-input" :id="'inlineTextInput-' + name" autoccomplete="off" ref="inlineInput" />
116+
type="text" class="button-text-input" :id="'inlineTextInput-' + name" autocomplete="off" ref="inlineInput" />
118117
</span>
119118
120119
<div v-if="hasCaret" class="dropdown-caret" v-html="caretIcon" :style="{ opacity: disabled ? 0.6 : 1 }">
121120
</div>
122121
122+
<div aria-live="polite" class="visually-hidden">{{ `${attributes.ariaLabel} ${active ? 'selected' : 'unset'}` }}</div>
123123
</div>
124124
</div>
125125
</template>
@@ -132,6 +132,14 @@ const caretIcon = computed(() => {
132132
margin: 0 1px;
133133
}
134134
135+
.visually-hidden {
136+
position: absolute;
137+
left: -9999px;
138+
height: 1px;
139+
width: 1px;
140+
overflow: hidden;
141+
}
142+
135143
.toolbar-button {
136144
padding: 5px;
137145
height: 32px;

0 commit comments

Comments
 (0)