From 3c592fd667e0a086cae9d66813d7aea815d2f489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Fern=C3=A1ndez?= Date: Sun, 8 Sep 2024 21:22:56 +0200 Subject: [PATCH] feat(a11y): add no transparency setting detection (#2455) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also refactored styles to use UnoCSS and fixed some type issues Signed-off-by: Fernando Fernández --- frontend/src/assets/styles/splashscreen.css | 2 +- .../components/Item/Card/GenericItemCard.vue | 2 +- .../src/components/Layout/AppBar/AppBar.vue | 4 +- frontend/src/components/Layout/Backdrop.vue | 33 +++------- .../Layout/Navigation/NavigationDrawer.vue | 3 +- frontend/src/components/lib/JApp.vue | 2 +- frontend/src/components/lib/JTransition.vue | 9 ++- frontend/src/composables/backdrop.ts | 2 +- frontend/src/pages/playback/video.vue | 66 +++++++++---------- frontend/src/splashscreen.ts | 2 +- frontend/src/store/index.ts | 6 +- frontend/types/global/util.d.ts | 8 +-- frontend/uno.config.ts | 7 +- 13 files changed, 70 insertions(+), 76 deletions(-) diff --git a/frontend/src/assets/styles/splashscreen.css b/frontend/src/assets/styles/splashscreen.css index 00fb12ef4ca..12cff94a945 100644 --- a/frontend/src/assets/styles/splashscreen.css +++ b/frontend/src/assets/styles/splashscreen.css @@ -4,7 +4,7 @@ align-items: center; justify-content: center; flex-direction: column; - background-color: var(--j-background-color); + background-color: var(--j-color-background); } .j-splash > img { diff --git a/frontend/src/components/Item/Card/GenericItemCard.vue b/frontend/src/components/Item/Card/GenericItemCard.vue index a25e4830ad9..156df44ce08 100644 --- a/frontend/src/components/Item/Card/GenericItemCard.vue +++ b/frontend/src/components/Item/Card/GenericItemCard.vue @@ -162,7 +162,7 @@ const hasClick = computed(() => !!attrs.onClick); @media (hover: hover) and (pointer: fine) { .card-box:hover .card-overlay-hover { - background: rgba(var(--v-theme-background), 0.5); + background: rgba(var(--j-color-background), 0.5); } .card-box:hover .card-overlay-hover .card-overlay-hover-hidden { opacity: 1; diff --git a/frontend/src/components/Layout/AppBar/AppBar.vue b/frontend/src/components/Layout/AppBar/AppBar.vue index dd77d974dbe..1017f8102dc 100644 --- a/frontend/src/components/Layout/AppBar/AppBar.vue +++ b/frontend/src/components/Layout/AppBar/AppBar.vue @@ -61,13 +61,13 @@ @@ -55,18 +55,3 @@ export function useBackdrop(hash?: MaybeRefOrGetter, opacity const blurhash = _blurhash; const opacity = _opacity; - - diff --git a/frontend/src/components/Layout/Navigation/NavigationDrawer.vue b/frontend/src/components/Layout/Navigation/NavigationDrawer.vue index d031c44910d..02353eddae8 100644 --- a/frontend/src/components/Layout/Navigation/NavigationDrawer.vue +++ b/frontend/src/components/Layout/Navigation/NavigationDrawer.vue @@ -43,6 +43,7 @@ import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; import type { RouteNamedMap } from 'vue-router/auto-routes'; import type { getLibraryIcon } from '@/utils/items'; +import { prefersNoTransparency } from '@/store'; export interface DrawerItem { icon: ReturnType; @@ -59,7 +60,7 @@ const route = useRoute(); const { t } = useI18n(); const drawer = inject>('NavigationDrawer'); -const transparentLayout = computed(() => route.meta.layout.transparent); +const transparentLayout = computed(() => !prefersNoTransparency.value && route.meta.layout.transparent); const items = [ { diff --git a/frontend/src/components/lib/JApp.vue b/frontend/src/components/lib/JApp.vue index 05c7eafdd46..8ac2d96e376 100644 --- a/frontend/src/components/lib/JApp.vue +++ b/frontend/src/components/lib/JApp.vue @@ -10,7 +10,7 @@ - --j-background-color: rgb(var(--v-theme-background)); + --j-color-background: rgb(var(--v-theme-background)); } diff --git a/frontend/src/components/lib/JTransition.vue b/frontend/src/components/lib/JTransition.vue index 59bb3aacb1d..7852a619c61 100644 --- a/frontend/src/components/lib/JTransition.vue +++ b/frontend/src/components/lib/JTransition.vue @@ -3,7 +3,7 @@ :is="group ? TransitionGroup : Transition" class="j-transition" v-bind="$attrs" - :name="prefersNoMotion || disabled || isSlow ? undefined : `j-transition-${name}`" + :name="forcedDisable || disabled ? undefined : `j-transition-${name}`" @before-leave="leaving = true" @after-leave="onNoLeave" @leave-cancelled="onNoLeave"> @@ -11,8 +11,8 @@ - +