feat(a11y): add semantic markup to interface settings (#2809)

Co-authored-by: TAKAHASHI Shuuji <shuuji3@gmail.com>
This commit is contained in:
Joaquín Sánchez 2024-04-14 20:06:25 +02:00 committed by GitHub
parent f78ce97f05
commit c504e14ff5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 143 additions and 143 deletions

View file

@ -67,7 +67,14 @@ function save() {
</script> </script>
<template> <template>
<section space-y-2>
<h2 id="interface-bn" font-medium>
{{ $t('settings.interface.bottom_nav') }}
</h2>
<form aria-labelledby="interface-bn" aria-describedby="interface-bn-desc" @submit.prevent="save"> <form aria-labelledby="interface-bn" aria-describedby="interface-bn-desc" @submit.prevent="save">
<p id="interface-bn-desc" pb-2>
{{ $t('settings.interface.bottom_nav_instructions') }}
</p>
<!-- preview --> <!-- preview -->
<div aria-hidden="true" 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
@ -124,4 +131,5 @@ function save() {
</button> </button>
</div> </div>
</form> </form>
</section>
</template> </template>

View file

@ -27,6 +27,10 @@ const modes = [
</script> </script>
<template> <template>
<section space-y-2>
<h2 id="interface-cm" font-medium>
{{ $t('settings.interface.color_mode') }}
</h2>
<div flex="~ gap4 wrap" w-full role="group" aria-labelledby="interface-cm"> <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"
@ -41,4 +45,5 @@ const modes = [
{{ $t(label) }} {{ $t(label) }}
</button> </button>
</div> </div>
</section>
</template> </template>

View file

@ -13,7 +13,11 @@ function setFontSize(e: Event) {
</script> </script>
<template> <template>
<div flex items-center space-x-4> <section space-y-2>
<h2 id="interface-fs" font-medium>
{{ $t('settings.interface.font_size') }}
</h2>
<div flex items-center space-x-4 select-settings>
<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
@ -47,6 +51,7 @@ function setFontSize(e: Event) {
</div> </div>
<span text-xl text-secondary>Aa</span> <span text-xl text-secondary>Aa</span>
</div> </div>
</section>
</template> </template>
<style> <style>
@ -64,7 +69,7 @@ function setFontSize(e: Event) {
input[type=range]::-webkit-slider-runnable-track { input[type=range]::-webkit-slider-runnable-track {
--at-apply: bg-secondary-light rounded-full h1 op60; --at-apply: bg-secondary-light rounded-full h1 op60;
} }
input[type=range]:focus:-webkit-slider-runnable-track { input[type=range]:focus::-webkit-slider-runnable-track {
--at-apply: outline-2 outline-red; --at-apply: outline-2 outline-red;
} }
input[type=range]::-webkit-slider-thumb { input[type=range]::-webkit-slider-thumb {

View file

@ -12,6 +12,10 @@ function updateTheme(theme: ThemeColors) {
</script> </script>
<template> <template>
<section space-y-2>
<h2 id="interface-tc" font-medium>
{{ $t('settings.interface.theme_color') }}
</h2>
<div flex="~ gap4 wrap" p2 role="group" aria-labelledby="interface-tc"> <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"
@ -28,4 +32,5 @@ function updateTheme(theme: ThemeColors) {
@click="updateTheme(theme)" @click="updateTheme(theme)"
/> />
</div> </div>
</section>
</template> </template>

View file

@ -13,34 +13,11 @@ useHydratedHead({
<span>{{ $t('settings.interface.label') }}</span> <span>{{ $t('settings.interface.label') }}</span>
</div> </div>
</template> </template>
<div p6 flex="~ col gap6"> <div px-6 pt-3 pb-6 flex="~ col gap6">
<div space-y-2> <SettingsFontSize />
<p id="interface-fs" font-medium>
{{ $t('settings.interface.font_size') }}
</p>
<SettingsFontSize select-settings />
</div>
<div space-y-2>
<p id="interface-cm" font-medium>
{{ $t('settings.interface.color_mode') }}
</p>
<SettingsColorMode /> <SettingsColorMode />
</div>
<div space-y-2>
<p id="interface-tc" font-medium>
{{ $t('settings.interface.theme_color') }}
</p>
<SettingsThemeColors /> <SettingsThemeColors />
</div>
<div space-y-2>
<p id="interface-bn" font-medium>
{{ $t('settings.interface.bottom_nav') }}
</p>
<p id="interface-bn-desc">
{{ $t('settings.interface.bottom_nav_instructions') }}
</p>
<SettingsBottomNav /> <SettingsBottomNav />
</div> </div>
</div>
</MainContent> </MainContent>
</template> </template>