fix(a11y): add aria-* entries to interface settings (#2799)
Co-authored-by: TAKAHASHI Shuuji <shuuji3@gmail.com>zio/stable
parent
8697cc44e4
commit
6bb9ad0511
|
@ -67,8 +67,9 @@ function save() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<form aria-labelledby="interface-bn" aria-describedby="interface-bn-desc" @submit.prevent="save">
|
||||||
<!-- preview -->
|
<!-- preview -->
|
||||||
<div flex="~ gap4 wrap" items-center select-settings h-14 p0>
|
<div aria-hidden="true" flex="~ gap4 wrap" items-center select-settings h-14 p0>
|
||||||
<nav
|
<nav
|
||||||
v-for="availableNavButton in selectedNavButtons" :key="availableNavButton.name"
|
v-for="availableNavButton in selectedNavButtons" :key="availableNavButton.name"
|
||||||
flex="~ 1" items-center justify-center text-xl
|
flex="~ 1" items-center justify-center text-xl
|
||||||
|
@ -100,6 +101,7 @@ function save() {
|
||||||
btn-outline font-bold py2 full-w sm-wa flex="~ gap2 center"
|
btn-outline font-bold py2 full-w sm-wa flex="~ gap2 center"
|
||||||
type="button"
|
type="button"
|
||||||
:disabled="selectedNavButtonNames.length === 0"
|
:disabled="selectedNavButtonNames.length === 0"
|
||||||
|
:class="selectedNavButtonNames.length === 0 ? 'border-none' : undefined"
|
||||||
@click="clear"
|
@click="clear"
|
||||||
>
|
>
|
||||||
<span aria-hidden="true" class="block i-ri:delete-bin-line" />
|
<span aria-hidden="true" class="block i-ri:delete-bin-line" />
|
||||||
|
@ -107,7 +109,7 @@ function save() {
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
btn-outline font-bold py2 full-w sm-wa flex="~ gap2 center"
|
btn-outline font-bold py2 full-w sm-wa flex="~ gap2 center"
|
||||||
type="button"
|
type="reset"
|
||||||
@click="reset"
|
@click="reset"
|
||||||
>
|
>
|
||||||
<span aria-hidden="true" class="block i-ri:repeat-line" />
|
<span aria-hidden="true" class="block i-ri:repeat-line" />
|
||||||
|
@ -116,10 +118,10 @@ function save() {
|
||||||
<button
|
<button
|
||||||
btn-solid font-bold py2 full-w sm-wa flex="~ gap2 center"
|
btn-solid font-bold py2 full-w sm-wa flex="~ gap2 center"
|
||||||
:disabled="!canSave"
|
:disabled="!canSave"
|
||||||
@click="save"
|
|
||||||
>
|
>
|
||||||
<span aria-hidden="true" i-ri:save-2-fill />
|
<span aria-hidden="true" i-ri:save-2-fill />
|
||||||
{{ $t('action.save') }}
|
{{ $t('action.save') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -27,12 +27,13 @@ const modes = [
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div flex="~ gap4 wrap" w-full>
|
<div flex="~ gap4 wrap" w-full role="group" aria-labelledby="interface-cm">
|
||||||
<button
|
<button
|
||||||
v-for="{ icon, label, mode } in modes"
|
v-for="{ icon, label, mode } in modes"
|
||||||
:key="mode"
|
:key="mode"
|
||||||
|
type="button"
|
||||||
btn-text flex-1 flex="~ gap-1 center" p4 border="~ base rounded" bg-base ws-nowrap
|
btn-text flex-1 flex="~ gap-1 center" p4 border="~ base rounded" bg-base ws-nowrap
|
||||||
:tabindex="colorMode.preference === mode ? 0 : -1"
|
:aria-pressed="colorMode.preference === mode ? 'true' : 'false'"
|
||||||
:class="colorMode.preference === mode ? 'pointer-events-none' : 'filter-saturate-0'"
|
:class="colorMode.preference === mode ? 'pointer-events-none' : 'filter-saturate-0'"
|
||||||
@click="setColorMode(mode)"
|
@click="setColorMode(mode)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -17,6 +17,7 @@ function setFontSize(e: Event) {
|
||||||
<span text-xs text-secondary>Aa</span>
|
<span text-xs text-secondary>Aa</span>
|
||||||
<div flex-1 relative flex items-center>
|
<div flex-1 relative flex items-center>
|
||||||
<input
|
<input
|
||||||
|
aria-labelledby="interface-fs"
|
||||||
:value="sizes.indexOf(userSettings.fontSize)"
|
:value="sizes.indexOf(userSettings.fontSize)"
|
||||||
:aria-valuetext="`${userSettings.fontSize}${userSettings.fontSize === DEFAULT_FONT_SIZE ? ` ${$t('settings.interface.default')}` : ''}`"
|
:aria-valuetext="`${userSettings.fontSize}${userSettings.fontSize === DEFAULT_FONT_SIZE ? ` ${$t('settings.interface.default')}` : ''}`"
|
||||||
:min="0"
|
:min="0"
|
||||||
|
|
|
@ -12,14 +12,16 @@ function updateTheme(theme: ThemeColors) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div flex="~ gap4 wrap" p2>
|
<div flex="~ gap4 wrap" p2 role="group" aria-labelledby="interface-tc">
|
||||||
<button
|
<button
|
||||||
v-for="[key, theme] in themes" :key="key"
|
v-for="[key, theme] in themes" :key="key"
|
||||||
:style="{
|
:style="{
|
||||||
'background': key,
|
'background': key,
|
||||||
'--local-ring-color': key,
|
'--local-ring-color': key,
|
||||||
}"
|
}"
|
||||||
|
type="button"
|
||||||
:class="currentTheme === theme['--theme-color-name'] ? 'ring-2' : 'scale-90'"
|
:class="currentTheme === theme['--theme-color-name'] ? 'ring-2' : 'scale-90'"
|
||||||
|
:aria-pressed="currentTheme === theme['--theme-color-name'] ? 'true' : 'false'"
|
||||||
:title="theme['--theme-color-name']"
|
:title="theme['--theme-color-name']"
|
||||||
w-8 h-8 rounded-full transition-all
|
w-8 h-8 rounded-full transition-all
|
||||||
ring="$local-ring-color offset-3 offset-$c-bg-base"
|
ring="$local-ring-color offset-3 offset-$c-bg-base"
|
||||||
|
|
|
@ -15,28 +15,28 @@ useHydratedHead({
|
||||||
</template>
|
</template>
|
||||||
<div p6 flex="~ col gap6">
|
<div p6 flex="~ col gap6">
|
||||||
<div space-y-2>
|
<div space-y-2>
|
||||||
<p font-medium>
|
<p id="interface-fs" font-medium>
|
||||||
{{ $t('settings.interface.font_size') }}
|
{{ $t('settings.interface.font_size') }}
|
||||||
</p>
|
</p>
|
||||||
<SettingsFontSize select-settings />
|
<SettingsFontSize select-settings />
|
||||||
</div>
|
</div>
|
||||||
<div space-y-2>
|
<div space-y-2>
|
||||||
<p font-medium>
|
<p id="interface-cm" font-medium>
|
||||||
{{ $t('settings.interface.color_mode') }}
|
{{ $t('settings.interface.color_mode') }}
|
||||||
</p>
|
</p>
|
||||||
<SettingsColorMode />
|
<SettingsColorMode />
|
||||||
</div>
|
</div>
|
||||||
<div space-y-2>
|
<div space-y-2>
|
||||||
<p font-medium>
|
<p id="interface-tc" font-medium>
|
||||||
{{ $t('settings.interface.theme_color') }}
|
{{ $t('settings.interface.theme_color') }}
|
||||||
</p>
|
</p>
|
||||||
<SettingsThemeColors />
|
<SettingsThemeColors />
|
||||||
</div>
|
</div>
|
||||||
<div space-y-2>
|
<div space-y-2>
|
||||||
<p font-medium>
|
<p id="interface-bn" font-medium>
|
||||||
{{ $t('settings.interface.bottom_nav') }}
|
{{ $t('settings.interface.bottom_nav') }}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p id="interface-bn-desc">
|
||||||
{{ $t('settings.interface.bottom_nav_instructions') }}
|
{{ $t('settings.interface.bottom_nav_instructions') }}
|
||||||
</p>
|
</p>
|
||||||
<SettingsBottomNav />
|
<SettingsBottomNav />
|
||||||
|
|
Loading…
Reference in New Issue