Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Fix mobile homepage jumping (#1470)
Olga Bulat8e5cebb297bf
diff --git a/src/components/VHeader/VSearchBar/VSearchBar.vue b/src/components/VHeader/VSearchBar/VSearchBar.vueindex 9e66870db..0dec7a19f 100644--- a/src/components/VHeader/VSearchBar/VSearchBar.vue+++ b/src/components/VHeader/VSearchBar/VSearchBar.vue@@ -30,7 +30,6 @@import { computed, defineComponent, PropType } from '@nuxtjs/composition-api'import { useMatchHomeRoute } from '~/composables/use-match-routes'-import { defineEvent } from '~/types/emits'import VInputField, {@@ -58,7 +57,6 @@ export default defineComponent({size: {type: String as PropType<keyof typeof FIELD_SIZES>,required: true,- validator: (v: string) => Object.keys(FIELD_SIZES).includes(v),},placeholder: {type: String,diff --git a/src/components/VHeader/VSearchBar/VSearchButton.vue b/src/components/VHeader/VSearchBar/VSearchButton.vueindex 538e96d8d..373d52972 100644--- a/src/components/VHeader/VSearchBar/VSearchButton.vue+++ b/src/components/VHeader/VSearchBar/VSearchButton.vue@@ -25,35 +25,26 @@</VButton></template>-<script>-import { defineComponent, computed } from '@nuxtjs/composition-api'+<script lang="ts">+import { defineComponent, computed, PropType } from '@nuxtjs/composition-api'import { isMinScreen } from '~/composables/use-media-query'import { useBrowserIsMobile } from '~/composables/use-browser-detection'import VIcon from '~/components/VIcon/VIcon.vue'import VButton from '~/components/VButton.vue'+import type { FieldSize } from '~/components/VInputField/VInputField.vue'import searchIcon from '~/assets/icons/search.svg'-/**- * @typedef Props- * @property {'small' | 'medium' | 'large' | 'standalone'} size- * @property {boolean} isHomeRoute- */-export default defineComponent({name: 'VSearchButton',components: { VIcon, VButton },inheritAttrs: false,props: {size: {- type: String,+ type: String as PropType<FieldSize>,required: true,- /**- * @param {string} v- */- validator: (v) => ['small', 'medium', 'large', 'standalone'].includes(v),},isHomeRoute: {type: Boolean,@@ -84,7 +75,7 @@ export default defineComponent({small: ['w-10', 'md:w-12', 'h-10', 'md:h-12'],medium: ['w-12', 'h-12'],large: ['w-14', 'h-14'],- standalone: ['w-14', 'md:w-auto', 'h-14', 'md:h-[69px]'],+ standalone: ['w-14', 'md:w-auto', 'h-full'],}[props.size]: undefined})diff --git a/src/components/VInputField/VInputField.vue b/src/components/VInputField/VInputField.vueindex 2721b49e5..d9f560542 100644--- a/src/components/VInputField/VInputField.vue+++ b/src/components/VInputField/VInputField.vue@@ -35,8 +35,9 @@ export const FIELD_SIZES = {small: 'h-10 text-md',medium: 'h-12',large: 'h-14',- standalone: 'h-14 md:h-[69px]',+ standalone: 'h-full',} as const+export type FieldSize = keyof typeof FIELD_SIZES/*** Provides a control to enter text as input.diff --git a/src/pages/index.vue b/src/pages/index.vueindex 8cfc333e7..328dd25f1 100644--- a/src/pages/index.vue+++ b/src/pages/index.vue@@ -43,7 +43,7 @@</div><VSearchBarv-model.trim="searchTerm"- class="max-w-[40rem] mt-4 lg:mt-8 group"+ class="max-w-[40rem] mt-4 lg:mt-8 group h-[57px] md:h-[69px]"size="standalone"@submit="handleSearch">@@ -85,7 +85,7 @@<!-- Height is 114.286vh i.e. 100vh * 8/7 (so that 0.75, 1, 1, 0.75 circles are visible) --><!-- Width is 57.143vh i.e. half of height (because grid dimensions are 4 ⨯ 2) --><div- class="homepage-images flex flex-row gap-4 lg:gap-0 items-center lg:grid lg:grid-cols-2 lg:grid-rows-4 lg:w-[57.143vh] lg:h-[114.286vh]"+ class="homepage-images flex flex-row gap-4 lg:gap-0 items-center lg:grid lg:grid-cols-2 lg:grid-rows-4 lg:w-[57.143vh] lg:h-[114.286vh] min-h-[120px]"aria-hidden><ClientOnly>@@ -102,9 +102,11 @@:style="{ '--transition-index': `${index * 0.05}s` }"><img- class="object-cover h-full w-full rounded-full"+ class="object-cover h-full w-full rounded-full aspect-square":src="image.src":alt="image.title"+ width="120"+ height="120":title="image.title"/></VLink>@@ -131,8 +133,14 @@</main></template>-<script>-import { onMounted, ref, useContext, useRouter } from '@nuxtjs/composition-api'+<script lang="ts">+import {+ defineComponent,+ onMounted,+ ref,+ useContext,+ useRouter,+} from '@nuxtjs/composition-api'import { ALL_MEDIA, supportedSearchTypes } from '~/constants/media'import { isMinScreen } from '~/composables/use-media-query'@@ -150,7 +158,7 @@ import imageInfo from '~/assets/homepage_images/image_info.json'import OpenverseLogo from '~/assets/logo.svg?inline'import OpenverseBrand from '~/assets/brand.svg?inline'-export default {+export default defineComponent({name: 'HomePage',components: {OpenverseLogo,@@ -242,7 +250,7 @@ export default {},],},-}+})</script><style>diff --git a/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-ltr-sm-linux.png b/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-ltr-sm-linux.pngindex dce349ec2..331c59889 100644Binary files a/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-ltr-sm-linux.png and b/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-ltr-sm-linux.png differdiff --git a/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-ltr-xs-linux.png b/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-ltr-xs-linux.pngindex 95c643329..664cba1c9 100644Binary files a/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-ltr-xs-linux.png and b/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-ltr-xs-linux.png differdiff --git a/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-rtl-sm-linux.png b/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-rtl-sm-linux.pngindex 85f3232c9..9f26ba85a 100644Binary files a/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-rtl-sm-linux.png and b/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-rtl-sm-linux.png differdiff --git a/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-rtl-xs-linux.png b/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-rtl-xs-linux.pngindex cb0c094cc..158bc4f74 100644Binary files a/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-rtl-xs-linux.png and b/test/playwright/visual-regression/homepage.spec.ts-snapshots/focused-search-rtl-xs-linux.png differdiff --git a/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-ltr-sm-linux.png b/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-ltr-sm-linux.pngindex 930bb8e0d..2e7ec8f92 100644Binary files a/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-ltr-sm-linux.png and b/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-ltr-sm-linux.png differdiff --git a/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-ltr-xs-linux.png b/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-ltr-xs-linux.pngindex 26be80b36..d6c14bfe5 100644Binary files a/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-ltr-xs-linux.png and b/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-ltr-xs-linux.png differdiff --git a/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-rtl-sm-linux.png b/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-rtl-sm-linux.pngindex dddd0ac1f..99b8633ed 100644Binary files a/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-rtl-sm-linux.png and b/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-rtl-sm-linux.png differdiff --git a/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-rtl-xs-linux.png b/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-rtl-xs-linux.pngindex 71e513cc1..1a52fed69 100644Binary files a/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-rtl-xs-linux.png and b/test/playwright/visual-regression/homepage.spec.ts-snapshots/index-rtl-xs-linux.png differdiff --git a/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-ltr-sm-linux.png b/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-ltr-sm-linux.pngindex 7e1f3706f..93cd7749a 100644Binary files a/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-ltr-sm-linux.png and b/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-ltr-sm-linux.png differdiff --git a/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-ltr-xs-linux.png b/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-ltr-xs-linux.pngindex 838f3c382..b789d3224 100644Binary files a/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-ltr-xs-linux.png and b/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-ltr-xs-linux.png differdiff --git a/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-rtl-sm-linux.png b/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-rtl-sm-linux.pngindex d48a1c88b..7b75c6eee 100644Binary files a/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-rtl-sm-linux.png and b/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-rtl-sm-linux.png differdiff --git a/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-rtl-xs-linux.png b/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-rtl-xs-linux.pngindex 8363b9900..d8e8a81ef 100644Binary files a/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-rtl-xs-linux.png and b/test/playwright/visual-regression/homepage.spec.ts-snapshots/unfocused-search-rtl-xs-linux.png differ