From 477bb54619de9e51fb82e36f33af037e2bf9eb73 Mon Sep 17 00:00:00 2001 From: TheMeinerLP Date: Sat, 28 Nov 2026 18:13:29 +0100 Subject: [PATCH 1/2] fix(ui): draw the search filter sheet with the shared side sheet On a phone the search filters opened as a full-screen overlay that the search view drew itself, with its own dialog role, scrim and stacking value. Every other sheet of the dashboard is drawn by MdSideSheet, so the filters now use it too. They keep their contents and their Show results action, focus returns to the Filters button when the sheet closes, and Escape closes it through the shared component. --- .../src/components/search/SearchView.test.ts | 38 +++++++++++- .../src/components/search/SearchView.vue | 60 +++++++++---------- 2 files changed, 65 insertions(+), 33 deletions(-) diff --git a/reposilite-frontend/src/components/search/SearchView.test.ts b/reposilite-frontend/src/components/search/SearchView.test.ts index 29adcdca39..99ae6eba3c 100644 --- a/reposilite-frontend/src/components/search/SearchView.test.ts +++ b/reposilite-frontend/src/components/search/SearchView.test.ts @@ -842,10 +842,46 @@ describe('SearchView keyboard', () => { expect(wrapper.find('[role="dialog"]').exists()).toBe(true) expect(wrapper.find('[data-test="open-filters"]').attributes('aria-expanded')).toBe('true') - await press(wrapper.find('[data-test="filter-panel"]'), 'Escape') + await press(wrapper.find('[data-ingot-component="md-side-sheet"]'), 'Escape') expect(wrapper.find('[role="dialog"]').exists()).toBe(false) }) + + it('draws the filter sheet with the shared side sheet', async () => { + await mountAt('/search') + + await wrapper.find('[data-test="open-filters"]').trigger('click') + + const sheet = wrapper.find('[data-ingot-component="md-side-sheet"]') + expect(sheet.exists(), 'the filters open in MdSideSheet, not in a view-drawn overlay').toBe(true) + expect(sheet.find('[data-test="filter-panel"]').exists(), 'the filter contents sit inside the sheet').toBe(true) + expect(sheet.find('[data-test="show-results"]').exists(), 'the sheet keeps its Show results action').toBe(true) + }) + + it('names the filter sheet by its Filters heading', async () => { + await mountAt('/search') + + await wrapper.find('[data-test="open-filters"]').trigger('click') + + const sheet = wrapper.find('[data-ingot-component="md-side-sheet"]') + const labelId = sheet.attributes('aria-labelledby') + expect(labelId, 'the sheet is labelled by an id').toBeTruthy() + expect(sheet.element.querySelector(`#${labelId}`)?.textContent?.trim()).toBe('Filters') + }) + + it('returns focus to the Filters trigger when the sheet closes on Escape', async () => { + await mountAt('/search') + const trigger = wrapper.find('[data-test="open-filters"]') + + trigger.element.focus() + await trigger.trigger('click') + await flushPromises() + await press(wrapper.find('[data-ingot-component="md-side-sheet"]'), 'Escape') + await flushPromises() + + expect(wrapper.find('[data-ingot-component="md-side-sheet"]').exists()).toBe(false) + expect(document.activeElement, 'focus goes back to the button that opened the sheet').toBe(trigger.element) + }) }) describe('SearchView cards', () => { diff --git a/reposilite-frontend/src/components/search/SearchView.vue b/reposilite-frontend/src/components/search/SearchView.vue index 1818559482..44d788ea72 100644 --- a/reposilite-frontend/src/components/search/SearchView.vue +++ b/reposilite-frontend/src/components/search/SearchView.vue @@ -26,6 +26,7 @@ import MdSkeleton from '../md/MdSkeleton.vue' import MdStatePanel from '../md/MdStatePanel.vue' import MdPage from '../md/MdPage.vue' import MdSelect from '../md/MdSelect.vue' +import MdSideSheet from '../md/MdSideSheet.vue' import SearchBar from './SearchBar.vue' import SearchFilters from './SearchFilters.vue' import SearchResultRow from './SearchResultRow.vue' @@ -342,38 +343,34 @@ const toggleRow = (item: SearchItem) => {

- + + + Show results + +
Date: Sat, 28 Nov 2026 18:24:42 +0100 Subject: [PATCH 2/2] test(ui): select the new filter sheet tests without plugin anchors Look up MdSideSheet and MdCard by component instead of data-ingot-component. --- .../src/components/search/SearchView.test.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/reposilite-frontend/src/components/search/SearchView.test.ts b/reposilite-frontend/src/components/search/SearchView.test.ts index 99ae6eba3c..8df74d494d 100644 --- a/reposilite-frontend/src/components/search/SearchView.test.ts +++ b/reposilite-frontend/src/components/search/SearchView.test.ts @@ -19,7 +19,9 @@ import { mount, flushPromises } from '@vue/test-utils' import type { DOMWrapper, VueWrapper } from '@vue/test-utils' import { createRouter, createMemoryHistory } from 'vue-router' import type { Router } from 'vue-router' -import type { Ref } from 'vue' +import type { Component, Ref } from 'vue' +import MdCard from '../md/MdCard.vue' +import MdSideSheet from '../md/MdSideSheet.vue' import * as session from '../../store/session' import SearchView from './SearchView.vue' @@ -842,7 +844,7 @@ describe('SearchView keyboard', () => { expect(wrapper.find('[role="dialog"]').exists()).toBe(true) expect(wrapper.find('[data-test="open-filters"]').attributes('aria-expanded')).toBe('true') - await press(wrapper.find('[data-ingot-component="md-side-sheet"]'), 'Escape') + await press(wrapper.find('[role="dialog"]'), 'Escape') expect(wrapper.find('[role="dialog"]').exists()).toBe(false) }) @@ -852,7 +854,7 @@ describe('SearchView keyboard', () => { await wrapper.find('[data-test="open-filters"]').trigger('click') - const sheet = wrapper.find('[data-ingot-component="md-side-sheet"]') + const sheet = wrapper.findComponent(MdSideSheet as Component) expect(sheet.exists(), 'the filters open in MdSideSheet, not in a view-drawn overlay').toBe(true) expect(sheet.find('[data-test="filter-panel"]').exists(), 'the filter contents sit inside the sheet').toBe(true) expect(sheet.find('[data-test="show-results"]').exists(), 'the sheet keeps its Show results action').toBe(true) @@ -863,7 +865,7 @@ describe('SearchView keyboard', () => { await wrapper.find('[data-test="open-filters"]').trigger('click') - const sheet = wrapper.find('[data-ingot-component="md-side-sheet"]') + const sheet = wrapper.find('[role="dialog"]') const labelId = sheet.attributes('aria-labelledby') expect(labelId, 'the sheet is labelled by an id').toBeTruthy() expect(sheet.element.querySelector(`#${labelId}`)?.textContent?.trim()).toBe('Filters') @@ -876,10 +878,10 @@ describe('SearchView keyboard', () => { trigger.element.focus() await trigger.trigger('click') await flushPromises() - await press(wrapper.find('[data-ingot-component="md-side-sheet"]'), 'Escape') + await press(wrapper.find('[role="dialog"]'), 'Escape') await flushPromises() - expect(wrapper.find('[data-ingot-component="md-side-sheet"]').exists()).toBe(false) + expect(wrapper.find('[role="dialog"]').exists()).toBe(false) expect(document.activeElement, 'focus goes back to the button that opened the sheet').toBe(trigger.element) }) }) @@ -889,7 +891,7 @@ describe('SearchView cards', () => { await mountAt('/search') const list = wrapper.find('[data-test="results"]') - expect(list.attributes('data-ingot-component'), 'the results sit on a shared card').toBe('md-card') + expect(wrapper.findAllComponents(MdCard as Component).map(card => card.element as Element), 'the results sit on a shared card').toContain(list.element) expect(list.attributes('data-variant'), 'the results lie flat on the page').toBe('low') }) @@ -898,7 +900,7 @@ describe('SearchView cards', () => { await mountAt('/search', { client }) const skeleton = wrapper.find('[data-test="skeleton"]') - expect(skeleton.attributes('data-ingot-component'), 'the skeleton sits on a shared card').toBe('md-card') + expect(wrapper.findAllComponents(MdCard as Component).map(card => card.element as Element), 'the skeleton sits on a shared card').toContain(skeleton.element) expect(skeleton.attributes('data-variant'), 'the skeleton lies flat on the page').toBe('low') }) })