-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
feat(core): fill the unified search pending window with placeholders #63343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
core/src/components/UnifiedSearch/SearchResultSkeleton.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| <!-- | ||
| - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors | ||
| - SPDX-License-Identifier: AGPL-3.0-or-later | ||
| --> | ||
| <template> | ||
| <div class="search-result-skeleton" aria-hidden="true"> | ||
| <div class="search-result-skeleton__bar search-result-skeleton__bar--heading" /> | ||
| <div | ||
| v-for="row in rows" | ||
| :key="row" | ||
| class="search-result-skeleton__bar" /> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| /** | ||
| * Results land a whole category at a time, so the block leads with a heading bar. | ||
| * | ||
| * Decoration only: the modal's live region announces the search state. | ||
| */ | ||
|
|
||
| defineProps<{ | ||
| /** Rows below the heading. The caller may overdraw: the panel clips and fades. */ | ||
| rows: number | ||
| }>() | ||
| </script> | ||
|
|
||
| <style lang="scss" scoped> | ||
| .search-result-skeleton { | ||
| --bar-block-size: calc(2lh + 2 * (2px + var(--default-grid-baseline) + 2px)); | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: calc(3 * var(--default-grid-baseline)); | ||
|
|
||
| &__bar { | ||
| flex: none; | ||
| position: relative; | ||
| overflow: hidden; | ||
| block-size: var(--bar-block-size); | ||
| border-radius: var(--border-radius-element); | ||
| background-color: var(--color-background-hover); | ||
|
|
||
| // Full width at one line reads as a divider; an explicit size also mirrors in RTL. | ||
| &--heading { | ||
| block-size: 1lh; | ||
| inline-size: 25%; | ||
| } | ||
|
|
||
| // Transform, not background-position: keeps the animation off the main thread. | ||
| &::after { | ||
| content: ''; | ||
| position: absolute; | ||
| inset: 0; | ||
| background-image: linear-gradient(90deg, transparent, var(--color-placeholder-light), transparent); | ||
| transform: translateX(-100%); | ||
| animation: search-result-skeleton-sweep 1.6s linear infinite; | ||
| } | ||
|
|
||
| &:dir(rtl)::after { | ||
| animation-direction: reverse; | ||
| } | ||
|
|
||
| @media (prefers-reduced-motion: reduce) { | ||
| &::after { | ||
| content: none; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @keyframes search-result-skeleton-sweep { | ||
| to { | ||
| transform: translateX(100%); | ||
| } | ||
| } | ||
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /*! | ||
| * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
| import { mount } from '@vue/test-utils' | ||
| import { describe, expect, it } from 'vitest' | ||
| import SearchResultSkeleton from '../../components/UnifiedSearch/SearchResultSkeleton.vue' | ||
|
|
||
| function factory(rows = 3) { | ||
| return mount(SearchResultSkeleton, { propsData: { rows } }) | ||
| } | ||
|
|
||
| describe('SearchResultSkeleton', () => { | ||
| // The rows asked for, plus the heading the block always leads with. | ||
| it('draws a heading bar above the rows', () => { | ||
| expect(factory(3).findAll('.search-result-skeleton__bar')).toHaveLength(4) | ||
| }) | ||
|
|
||
| it('is decoration: hidden from assistive tech and out of the tab order', () => { | ||
| const wrapper = factory() | ||
|
|
||
| expect(wrapper.attributes('aria-hidden')).toBe('true') | ||
| // aria-hidden does not remove a focusable child from the tab order. | ||
| expect(wrapper.findAll('a, button, input, [tabindex]')).toHaveLength(0) | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default derived from three providers with one result each. We can tweak this over time if its too jumpy.
Another solution is to keep a running average height stored in localstorage, but that feels like overkill
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or not show any placeholders at all on first search (empty list with only loading spinner indicating state)