From 5e179a35b23282c4613582755de06a91f6991309 Mon Sep 17 00:00:00 2001 From: zeroinformatique Date: Sun, 18 Oct 2020 00:22:04 +0200 Subject: viewer: accessibility: set focus on the main area (#273) github: resolves #177--- viewer/src/views/MainLayout.vue | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'viewer/src/views/MainLayout.vue') diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue index 6ef9a3b..9cd518b 100644 --- a/viewer/src/views/MainLayout.vue +++ b/viewer/src/views/MainLayout.vue @@ -22,7 +22,7 @@ - + @@ -43,6 +43,10 @@ export default class MainLayout extends Vue { isLoading: boolean = true; scrollPositions: ScrollPosition = {}; + get contentDiv() { + return this.content.$el as HTMLDivElement; + } + mounted() { history.replaceState({ ldgallery: "ENTRYPOINT" }, ""); this.fetchGalleryItems(); @@ -53,11 +57,15 @@ export default class MainLayout extends Vue { document.body.removeEventListener("fullscreenchange", this.onFullscreenChange); } + moveFocusToContentDiv() { + setTimeout(() => this.contentDiv.focus()); + } + @Watch("$route") routeChanged(newRoute: Route, oldRoute: Route) { - const el = this.content.$el; - this.scrollPositions[oldRoute.path] = el.scrollTop; - this.$nextTick(() => (el.scrollTop = this.scrollPositions[newRoute.path])); + this.scrollPositions[oldRoute.path] = this.contentDiv.scrollTop; + this.$nextTick(() => (this.contentDiv.scrollTop = this.scrollPositions[newRoute.path])); + this.moveFocusToContentDiv(); } fetchGalleryItems() { @@ -66,6 +74,7 @@ export default class MainLayout extends Vue { .fetchConfig() .then(this.$uiStore.initFromConfig) .then(this.$galleryStore.fetchGalleryItems) + .then(this.moveFocusToContentDiv) .finally(() => (this.isLoading = false)) .catch(this.displayError); } @@ -130,6 +139,9 @@ html { left: var(--layout-left); z-index: 3; overflow-x: hidden; + &:focus { + outline: none; + } } } .fullscreen { -- cgit v1.2.3 From 9165cc1efcf7791f78b61b2c51a9de651b1b09aa Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Fri, 2 Jul 2021 22:53:16 +0200 Subject: viewer: types normalization - gallery.d.ts GitHub: closes #301 --- viewer/src/views/MainLayout.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'viewer/src/views/MainLayout.vue') diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue index 9cd518b..edca4bf 100644 --- a/viewer/src/views/MainLayout.vue +++ b/viewer/src/views/MainLayout.vue @@ -29,10 +29,10 @@ -- cgit v1.2.3 From cddf5d5c42795388dbd9058268160f1e867d64f5 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Sat, 3 Jul 2021 05:06:44 +0200 Subject: viewer: use CSS module (MainLayout) Extracted from 0f4a1d1 (GH PR #304). --- viewer/src/views/MainLayout.vue | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'viewer/src/views/MainLayout.vue') diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue index eee813f..c54f183 100644 --- a/viewer/src/views/MainLayout.vue +++ b/viewer/src/views/MainLayout.vue @@ -18,11 +18,17 @@ --> @@ -40,18 +39,32 @@ import { Component, Ref, Vue, Watch } from "vue-property-decorator"; import { Route } from "vue-router"; import PanelLeft from "./PanelLeft.vue"; import PanelTop from "./PanelTop.vue"; +import SplashScreen from "./SplashScreen.vue"; @Component({ - components: { PanelLeft, PanelTop }, + components: { + PanelLeft, + PanelTop, + SplashScreen, + }, }) export default class MainLayout extends Vue { - @Ref() readonly content!: Vue; + @Ref() readonly content?: Vue; isLoading: boolean = true; scrollPositions: ScrollPosition = {}; - get contentDiv() { - return this.content.$el as HTMLDivElement; + get contentDiv(): HTMLDivElement | null { + return (this.content?.$el as HTMLDivElement) ?? null; + } + + get isReady(): boolean { + return ( + !this.$uiStore.splashScreenEnabled && + !this.isLoading && + this.$galleryStore.config !== null && + this.$galleryStore.currentPath !== null + ); } mounted() { @@ -65,13 +78,14 @@ export default class MainLayout extends Vue { } moveFocusToContentDiv() { - setTimeout(() => this.contentDiv.focus()); + setTimeout(() => this.contentDiv?.focus()); } @Watch("$route") routeChanged(newRoute: Route, oldRoute: Route) { + if (!this.contentDiv) return; this.scrollPositions[oldRoute.path] = this.contentDiv.scrollTop; - this.$nextTick(() => (this.contentDiv.scrollTop = this.scrollPositions[newRoute.path])); + this.$nextTick(() => (this.contentDiv!.scrollTop = this.scrollPositions[newRoute.path])); this.moveFocusToContentDiv(); } @@ -86,14 +100,10 @@ export default class MainLayout extends Vue { .catch(this.displayError); } - get isReady() { - return !this.isLoading && this.$galleryStore.config && this.$galleryStore.currentPath !== null; - } - displayError(reason: any) { this.$buefy.snackbar.open({ message: `${reason}`, - actionText: "Retry", + actionText: this.$t("snack.retry"), position: "is-top", type: "is-danger", indefinite: true, -- cgit v1.2.3 From 00510820a2794efcadbc83f7f8b54318fe198ecb Mon Sep 17 00:00:00 2001 From: Zéro~Informatique Date: Tue, 26 Jul 2022 08:44:34 +0200 Subject: viewer: migrate to vue 3, general refactoring and cleanup Non-exhaustive list of fixes and improvements done at the same time: - html default background to grey (avoids white flash during init) - unified links behavior - added more theme variables - removed the flex-expand transition (it wasn't working) and replaced it with a slide - fixed LdLoading not centered on the content - title on removable tags - fixed an issue with encoded URI from vue-router - unified Item resource URLs - removed the iframe for PlainTextViewer (it wasn't working properly) and replaced it with a pre - fixed clear and search buttons tabindex - fixed the information panel bumping up during the fade animation of tag's dropdown - fixed some focus outlines not appearing correctly - moved CSS variables to the :root context - Code cleaning GitHub: closes #217 GitHub: closes #300 GitHub: closes #297 GitHub: closes #105 GitHub: closes #267 GitHub: closes #275 GitHub: closes #228 GitHub: closes #215 GitHub: closes #112 --- viewer/src/views/MainLayout.vue | 173 ++++++++++++++++------------------------ 1 file changed, 68 insertions(+), 105 deletions(-) (limited to 'viewer/src/views/MainLayout.vue') diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue index 2347ba7..9c84116 100644 --- a/viewer/src/views/MainLayout.vue +++ b/viewer/src/views/MainLayout.vue @@ -1,7 +1,7 @@ -