SearchType.Accordion UX improvement (#26935)

* Update default SearchType.Accordion behavior to NOT close accordion after selection.

Signed-off-by: Sydney Achinger <sydneynicoleachinger@spotify.com>
This commit is contained in:
Sydney Achinger
2024-10-02 15:24:27 -04:00
committed by GitHub
parent fe26a38138
commit 88d03d85df
3 changed files with 5 additions and 13 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-search': patch
---
Updated the default SearchType.Accordion behavior to remain open after result type selection. This is a UX improvement to reduce the number of clicks needed when toggling result type filters.
@@ -140,18 +140,6 @@ describe('SearchType.Accordion', () => {
expect(setPageCursorMock).toHaveBeenCalledWith(undefined);
});
it('should collapse when a new type is selected', async () => {
const { getByText, queryByText } = render(
<Wrapper>
<SearchType.Accordion name={expectedLabel} types={[expectedType]} />
</Wrapper>,
);
await user.click(getByText(expectedType.name));
expect(queryByText('Collapse')).not.toBeInTheDocument();
});
it('should show result counts if enabled', async () => {
const { getAllByText } = render(
<Wrapper>
@@ -96,7 +96,6 @@ export const SearchTypeAccordion = (props: SearchTypeAccordionProps) => {
return () => {
setTypes(type !== '' ? [type] : []);
setPageCursor(undefined);
setExpanded(false);
};
};