feat(settings): improve input setting accessibility

This commit is contained in:
2026-07-28 20:08:34 +02:00
committed by jakob.scheid
parent 62fbd5de3a
commit 3136f40530
3 changed files with 31 additions and 6 deletions
@@ -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
View File
@@ -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
View File
@@ -38,5 +38,13 @@
} }
} }
}, },
"slogan": "Built to search." "slogan": "Built to search.",
"settings": {
"input": {
"done": {
"title": "Save value",
"ariaLabel": "Saves the entered value"
}
}
}
} }