Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Add "skip to content" links to the homepage and the 404 page; fix footer role (#2180)

Olga Bulatfe4d2acd2d46
diff --git a/src/components/VFourOhFour.vue b/src/components/VFourOhFour.vue
index 888bbe536..a0f3e1270 100644
--- a/src/components/VFourOhFour.vue
+++ b/src/components/VFourOhFour.vue
@@ -1,9 +1,7 @@
<template>
- <div
- class="error relative flex flex-grow flex-col overflow-x-hidden px-6 sm:px-0"
- >
+ <div class="error grid overflow-x-hidden">
<svg
- class="z-0 pointer-events-none absolute top-20 -mt-[10%] -ml-[20%] w-[140%] fill-dark-charcoal px-6 opacity-5 lg:mx-auto lg:ml-0 lg:w-full lg:px-16"
+ class="z-0 pointer-events-none col-start-1 row-start-1 -mx-[15%] fill-dark-charcoal opacity-5 lg:mx-15 lg:-mt-20"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 1320 569"
aria-hidden="true"
@@ -12,12 +10,15 @@
<use :href="`${Oops}#oops`" />
</svg>
- <main
- class="page-404 flex w-full flex-shrink-0 flex-grow flex-col overflow-x-hidden px-6 lg:mx-auto lg:max-w-2xl lg:px-0"
+ <div
+ class="page-404 col-start-1 row-start-1 flex flex-col justify-self-stretch px-6 lg:max-w-2xl lg:justify-self-center lg:px-0"
>
<!-- Push content by 1/4th height without absolute positioning. -->
<div class="spacer grow" />
- <div class="z-10 grow-[3] space-y-4 lg:space-y-6">
+ <VSkipToContentContainer
+ as="main"
+ class="z-10 grow-[3] space-y-4 lg:space-y-6"
+ >
<h1 class="heading-5 lg:heading-2 mb-6 lg:mb-10 lg:leading-tight">
{{ $t("404.title") }}
</h1>
@@ -33,8 +34,8 @@
</i18n>
</p>
<VStandaloneSearchBar route="404" @submit="handleSearch" />
- </div>
- </main>
+ </VSkipToContentContainer>
+ </div>
</div>
</template>
@@ -45,8 +46,9 @@ import { useSearchStore } from "~/stores/search"
import { ALL_MEDIA } from "~/constants/media"
-import VStandaloneSearchBar from "~/components/VHeader/VSearchBar/VStandaloneSearchBar.vue"
import VLink from "~/components/VLink.vue"
+import VSkipToContentContainer from "~/components/VSkipToContentContainer.vue"
+import VStandaloneSearchBar from "~/components/VHeader/VSearchBar/VStandaloneSearchBar.vue"
import Oops from "~/assets/oops.svg"
@@ -54,6 +56,7 @@ export default defineComponent({
name: "VFourOhFour",
components: {
VLink,
+ VSkipToContentContainer,
VStandaloneSearchBar,
},
props: ["error"],
diff --git a/src/components/VHomepageContent.vue b/src/components/VHomepageContent.vue
index d294fdfb1..51a60a601 100644
--- a/src/components/VHomepageContent.vue
+++ b/src/components/VHomepageContent.vue
@@ -1,5 +1,5 @@
<template>
- <div ref="nodeRef">
+ <VSkipToContentContainer>
<h1
class="mt-auto mb-2 text-[40px] font-light leading-tight lg:text-[63px]"
>
@@ -66,7 +66,7 @@
>
</template>
</i18n>
- </div>
+ </VSkipToContentContainer>
</template>
<script lang="ts">
import { computed, ref, PropType } from "@nuxtjs/composition-api"
@@ -84,6 +84,7 @@ import VLink from "~/components/VLink.vue"
import VPopoverContent from "~/components/VPopover/VPopoverContent.vue"
import VSearchTypeButton from "~/components/VContentSwitcher/VSearchTypeButton.vue"
import VSearchTypes from "~/components/VContentSwitcher/VSearchTypes.vue"
+import VSkipToContentContainer from "~/components/VSkipToContentContainer.vue"
import VStandaloneSearchBar from "~/components/VHeader/VSearchBar/VStandaloneSearchBar.vue"
export default {
@@ -93,6 +94,7 @@ export default {
VSearchTypes,
VPopoverContent,
VSearchTypeButton,
+ VSkipToContentContainer,
VStandaloneSearchBar,
VLink,
},
@@ -111,13 +113,13 @@ export default {
},
},
setup(props, { emit }) {
- const nodeRef = ref<HTMLElement | null>(null)
const searchTypeButtonRef = ref<InstanceType<
typeof VSearchTypeButton
> | null>(null)
const searchBarRef = ref<InstanceType<typeof VStandaloneSearchBar> | null>(
null
)
+ const nodeRef = computed(() => searchBarRef.value?.$el)
const { getSearchTypeProps } = useSearchType()
const uiStore = useUiStore()
@@ -163,7 +165,6 @@ export default {
})
return {
- nodeRef,
searchTypeButtonRef,
searchBarRef,
diff --git a/src/layouts/default.vue b/src/layouts/default.vue
index d7826fc09..d515553fd 100644
--- a/src/layouts/default.vue
+++ b/src/layouts/default.vue
@@ -8,11 +8,8 @@
<VBanners />
<VHeaderInternal class="bg-yellow" />
</div>
-
- <div class="grid flex-grow grid-rows-[1fr,auto]">
- <Nuxt />
- <VFooter mode="search" class="bg-yellow" />
- </div>
+ <Nuxt class="flex-grow" />
+ <VFooter mode="search" class="bg-yellow" />
<VModalTarget class="modal" />
<VGlobalAudioSection />
@@ -27,7 +24,9 @@ import { useLayout } from "~/composables/use-layout"
import { useUiStore } from "~/stores/ui"
import VBanners from "~/components/VBanner/VBanners.vue"
+import VFooter from "~/components/VFooter/VFooter.vue"
import VGlobalAudioSection from "~/components/VGlobalAudioSection/VGlobalAudioSection.vue"
+import VHeaderInternal from "~/components/VHeader/VHeaderInternal.vue"
import VModalTarget from "~/components/VModal/VModalTarget.vue"
/**
@@ -37,11 +36,11 @@ export default defineComponent({
name: "DefaultLayout",
components: {
VBanners,
- VHeaderInternal: () => import("~/components/VHeader/VHeaderInternal.vue"),
- VFooter: () => import("~/components/VFooter/VFooter.vue"),
+ VFooter,
+ VGlobalAudioSection,
+ VHeaderInternal,
VModalTarget,
VTeleportTarget,
- VGlobalAudioSection,
},
setup() {
const uiStore = useUiStore()
diff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-ltr-xs-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-ltr-xs-linux.png
index 5d2b349fb..0cd369207 100644
Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-ltr-xs-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-ltr-xs-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-2xl-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-2xl-linux.png
index d6d797e90..602dad26d 100644
Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-2xl-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-2xl-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-lg-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-lg-linux.png
index aa2484daa..583b1aac5 100644
Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-lg-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-lg-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-xl-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-xl-linux.png
index f50986291..61417b99a 100644
Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-xl-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-xl-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-xs-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-xs-linux.png
index 5135d7486..8df25bb20 100644
Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-xs-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/non-existent-rtl-xs-linux.png differ