Skip to content

Commit f9a9f4f

Browse files
feat: improvement a11y and translate
1 parent b1285d7 commit f9a9f4f

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

Diff for: src/components/VoiceCapture.vue

+18-10
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,26 @@
33
class="voicecapture"
44
:class="{ active: status, [mode]: mode }"
55
@click="deactivateVoice"
6+
aria-modal="true"
7+
role="dialog"
8+
:aria-expanded="status ? 'true' : 'false'"
69
>
7-
<button class="exit" type="button" @click="deactivateVoice">
8-
<i class="icon icon-exit">X</i>
10+
<button
11+
class="exit"
12+
@click="deactivateVoice"
13+
:aria-label="getTranslation('close')"
14+
type="button"
15+
>
16+
<i class="icon icon-exit" aria-hidden="true">X</i>
917
</button>
10-
<p class="text-tip">{{ translatedText }}</p>
18+
<p class="text-tip" aria-live="polite">{{ translatedText }}</p>
1119
<button
1220
type="button"
1321
class="btn-voice"
1422
:class="{ active: animationButton }"
23+
:aria-label="getTranslation('open')"
1524
>
16-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
25+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true">
1726
<path d="M17 11.998c0 2.76-2.23 5-4.99 5l-.002.002a4.994 4.994 0 01-4.979-5h-2c0 3.52 2.59 6.433 5.98 6.92v3.078h.01V22h2v-3.08h-.01A6.982 6.982 0 0019 11.998z" />
1827
<path fill="none" d="M0 0h24v24H0z" />
1928
<path d="M12 15c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v7c0 1.66 1.34 3 3 3z" />
@@ -66,12 +75,10 @@ export default {
6675
};
6776
6877
const deactivateVoice = () => {
69-
if (recognizing.value && recognition.value) {
70-
recognizing.value = false;
71-
animationButton.value = false;
72-
recognition.value.stop();
73-
emit('onStatus', false);
74-
}
78+
recognizing.value = false;
79+
animationButton.value = false;
80+
recognition.value.stop();
81+
emit('onStatus', false);
7582
};
7683
7784
const setupVoiceRecognition = () => {
@@ -169,6 +176,7 @@ export default {
169176
translatedText,
170177
activateVoice,
171178
deactivateVoice,
179+
getTranslation
172180
};
173181
},
174182
};

0 commit comments

Comments
 (0)