fix(a11y): show bottom nav button labels
This commit is contained in:
parent
ed70b3c611
commit
411fcc83f0
16 changed files with 91 additions and 15 deletions
|
|
@ -2,10 +2,14 @@
|
|||
defineProps<{
|
||||
activeClass: string
|
||||
}>()
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink to="/bookmarks" :aria-label="$t('nav.bookmarks')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<NuxtLink to="/bookmarks" :aria-label="$t('nav.bookmarks')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<div i-ri:bookmark-line />
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.bookmarks') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,14 @@
|
|||
defineProps<{
|
||||
activeClass: string
|
||||
}>()
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink to="/compose" :aria-label="$t('nav.favourites')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<NuxtLink to="/compose" :aria-label="$t('nav.favourites')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<div i-ri:quill-pen-line />
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.favourites') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -6,10 +6,20 @@ defineProps<{
|
|||
}>()
|
||||
|
||||
const lastAccessedExploreRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, '')
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink :to="`/${currentServer}/explore/${lastAccessedExploreRoute}`" :aria-label="$t('nav.explore')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<NuxtLink
|
||||
:to="`/${currentServer}/explore/${lastAccessedExploreRoute}`"
|
||||
:aria-label="$t('nav.explore')"
|
||||
:active-class="activeClass"
|
||||
flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none"
|
||||
@click="$scrollToTop"
|
||||
>
|
||||
<div i-ri:compass-3-line />
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.explore') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,14 @@
|
|||
defineProps<{
|
||||
activeClass: string
|
||||
}>()
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink to="/favourites" :aria-label="$t('nav.favourites')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<NuxtLink to="/favourites" :aria-label="$t('nav.favourites')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<div i-ri:heart-line />
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.favourites') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,14 @@
|
|||
defineProps<{
|
||||
activeClass: string
|
||||
}>()
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink :to="`/${currentServer}/public`" :aria-label="$t('nav.federated')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<NuxtLink :to="`/${currentServer}/public`" :aria-label="$t('nav.federated')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<div i-ri:earth-line />
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.federated') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,14 @@
|
|||
defineProps<{
|
||||
activeClass: string
|
||||
}>()
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink to="/hashtags" :aria-label="$t('nav.hashtags')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<NuxtLink to="/hashtags" :aria-label="$t('nav.hashtags')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<div i-ri:hashtag />
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.hashtags') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,14 @@
|
|||
defineProps<{
|
||||
activeClass: string
|
||||
}>()
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink to="/home" :aria-label="$t('nav.home')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<NuxtLink to="/home" :aria-label="$t('nav.home')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<div i-ri:home-5-line />
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.home') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
defineProps<{
|
||||
activeClass: string
|
||||
}>()
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -9,9 +12,10 @@ defineProps<{
|
|||
to="/lists"
|
||||
:aria-label="$t('nav.lists')"
|
||||
:active-class="activeClass"
|
||||
flex flex-row items-center place-content-center h-full flex-1
|
||||
flex flex-col items-center place-content-center h-full flex-1
|
||||
class="coarse-pointer:select-none" @click="$scrollToTop"
|
||||
>
|
||||
<div i-ri:list-check />
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.lists') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,20 @@
|
|||
defineProps<{
|
||||
activeClass: string
|
||||
}>()
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink group :to="`/${currentServer}/public/local`" :aria-label="$t('nav.local')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<NuxtLink
|
||||
group
|
||||
:to="`/${currentServer}/public/local`"
|
||||
:aria-label="$t('nav.local')" :active-class="activeClass"
|
||||
flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none"
|
||||
@click="$scrollToTop"
|
||||
>
|
||||
<div i-ri:group-2-line />
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.local') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -2,14 +2,19 @@
|
|||
defineProps<{
|
||||
activeClass: string
|
||||
}>()
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink
|
||||
to="/conversations" :aria-label="$t('nav.conversations')"
|
||||
:active-class="activeClass" flex flex-row items-center place-content-center h-full
|
||||
flex-1 class="coarse-pointer:select-none" @click="$scrollToTop"
|
||||
to="/conversations"
|
||||
:aria-label="$t('nav.conversations')"
|
||||
:active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none"
|
||||
@click="$scrollToTop"
|
||||
>
|
||||
<div i-ri:at-line />
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.conversations') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<script setup lang="ts">
|
||||
const model = defineModel<boolean>()
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -8,12 +11,13 @@ const model = defineModel<boolean>()
|
|||
place-content-center h-full flex-1 cursor-pointer
|
||||
>
|
||||
<button
|
||||
flex items-center place-content-center h-full flex-1 class="select-none"
|
||||
flex flex-col items-center place-content-center h-full flex-1 class="select-none"
|
||||
:class="show ? '!text-primary' : ''"
|
||||
:aria-label="$t('nav.more_menu')"
|
||||
@click="toggleVisible"
|
||||
>
|
||||
<span :class="show ? 'i-ri:close-fill' : 'i-ri:more-fill'" />
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.more_menu') }}</span>
|
||||
</button>
|
||||
</NavBottomMoreMenu>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -6,15 +6,19 @@ defineProps<{
|
|||
}>()
|
||||
const { notifications } = useNotifications()
|
||||
const lastAccessedNotificationRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE, '')
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink :to="`/notifications/${lastAccessedNotificationRoute}`" :aria-label="$t('nav.notifications')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<NuxtLink :to="`/notifications/${lastAccessedNotificationRoute}`" :aria-label="$t('nav.notifications')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<div flex relative>
|
||||
<div class="i-ri:notification-4-line" text-xl />
|
||||
<div v-if="notifications" class="top-[-0.3rem] right-[-0.3rem]" absolute font-bold rounded-full h-4 w-4 text-xs bg-primary text-inverted flex items-center justify-center>
|
||||
{{ notifications < 10 ? notifications : '•' }}
|
||||
</div>
|
||||
</div>
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.notifications') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,14 @@
|
|||
defineProps<{
|
||||
activeClass: string
|
||||
}>()
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
const hideLabel = getPreferences(userSettings.value, 'hideBottomNavLabel')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink to="/search" :aria-label="$t('nav.search')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<NuxtLink to="/search" :aria-label="$t('nav.search')" :active-class="activeClass" flex flex-col items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||
<div i-ri:search-line />
|
||||
<span v-if="!hideLabel" text-xs>{{ $t('nav.search') }}</span>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
import type { NavButtonName } from '~/composables/settings'
|
||||
import { STORAGE_KEY_BOTTOM_NAV_BUTTONS } from '~/constants'
|
||||
|
||||
const userSettings = useUserSettings()
|
||||
|
||||
interface NavButton {
|
||||
name: NavButtonName
|
||||
label: string
|
||||
|
|
@ -136,5 +138,11 @@ function save() {
|
|||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<SettingsToggleItem
|
||||
:checked="getPreferences(userSettings, 'hideBottomNavLabel')"
|
||||
@click="togglePreferences('hideBottomNavLabel')"
|
||||
>
|
||||
{{ $t('settings.interface.bottom_nav_hide_label') }}
|
||||
</SettingsToggleItem>
|
||||
</section>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ export interface PreferencesSettings {
|
|||
experimentalGitHubCards: boolean
|
||||
experimentalUserPicker: boolean
|
||||
experimentalEmbeddedMedia: boolean
|
||||
hideBottomNavLabel: boolean
|
||||
}
|
||||
|
||||
export interface UserSettings {
|
||||
|
|
@ -88,6 +89,7 @@ export const DEFAULT__PREFERENCES_SETTINGS: PreferencesSettings = {
|
|||
experimentalGitHubCards: true,
|
||||
experimentalUserPicker: true,
|
||||
experimentalEmbeddedMedia: false,
|
||||
hideBottomNavLabel: false,
|
||||
}
|
||||
|
||||
export function getDefaultUserSettings(locales: string[]): UserSettings {
|
||||
|
|
|
|||
|
|
@ -455,6 +455,7 @@
|
|||
},
|
||||
"interface": {
|
||||
"bottom_nav": "Bottom Navigation",
|
||||
"bottom_nav_hide_label": "Hide bottom labels",
|
||||
"bottom_nav_instructions": "Choose your favorite navigation buttons up to five for the bottom navigation. Must include the \"More menu\" button.",
|
||||
"color_mode": "Color Mode",
|
||||
"dark_mode": "Dark",
|
||||
|
|
|
|||
Loading…
Reference in a new issue