generated from Seekra/repository-template
feat(settings): improve input setting accessibility
This commit is contained in:
@@ -19,7 +19,7 @@ import Icon from '@/features/icons/components/Icon.vue';
|
|||||||
|
|
||||||
import { useSettingsStore } from '../stores/settingsStore';
|
import { useSettingsStore } from '../stores/settingsStore';
|
||||||
|
|
||||||
import { computed } from 'vue';
|
import { computed, useId } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@@ -37,6 +37,8 @@ const store = useSettingsStore();
|
|||||||
|
|
||||||
const inputModel = defineModel();
|
const inputModel = defineModel();
|
||||||
inputModel.value = store.get(props.path);
|
inputModel.value = store.get(props.path);
|
||||||
|
const inputId = useId();
|
||||||
|
const inputLabelId = useId();
|
||||||
|
|
||||||
const inputClass = computed(() => ({
|
const inputClass = computed(() => ({
|
||||||
number: 'number',
|
number: 'number',
|
||||||
@@ -55,9 +57,9 @@ const apply = function apply () {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="input-setting-container">
|
<div class="input-setting-container">
|
||||||
<div>
|
<label :for="inputId" :id="inputLabelId">
|
||||||
{{ t(props.setting.i18n) }}
|
{{ t(props.setting.i18n) }}
|
||||||
</div>
|
</label>
|
||||||
<form
|
<form
|
||||||
@submit.prevent="apply"
|
@submit.prevent="apply"
|
||||||
class="input-container"
|
class="input-container"
|
||||||
@@ -65,10 +67,17 @@ const apply = function apply () {
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
:type="inputClass"
|
:type="inputClass"
|
||||||
|
:id="inputId"
|
||||||
|
:aria-labelledby="inputLabelId"
|
||||||
v-model="inputModel"
|
v-model="inputModel"
|
||||||
class="input"
|
class="input"
|
||||||
/>
|
/>
|
||||||
<button class="done-button button" type="submit">
|
<button
|
||||||
|
class="done-button button"
|
||||||
|
type="submit"
|
||||||
|
:title="t('settings.input.done.title')"
|
||||||
|
:aria-label="t('settings.input.done.ariaLabel')"
|
||||||
|
>
|
||||||
<Icon name="check-mark" />
|
<Icon name="check-mark" />
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
+9
-1
@@ -38,5 +38,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"slogan": "Gebaut zum Suchen."
|
"slogan": "Gebaut zum Suchen.",
|
||||||
|
"settings": {
|
||||||
|
"input": {
|
||||||
|
"done": {
|
||||||
|
"title": "Wert speichern",
|
||||||
|
"ariaLabel": "Speichert den eingegebenen Wert"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+9
-1
@@ -38,5 +38,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"slogan": "Built to search."
|
"slogan": "Built to search.",
|
||||||
|
"settings": {
|
||||||
|
"input": {
|
||||||
|
"done": {
|
||||||
|
"title": "Save value",
|
||||||
|
"ariaLabel": "Saves the entered value"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user