Skip to content

Commit

Permalink
SearchType.Accordion UX improvement (backstage#26935)
Browse files Browse the repository at this point in the history
* Update default SearchType.Accordion behavior to NOT close accordion after selection.

Signed-off-by: Sydney Achinger <[email protected]>
  • Loading branch information
squid-ney authored Oct 2, 2024
1 parent fe26a38 commit 88d03d8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-plants-retire.md
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export const SearchTypeAccordion = (props: SearchTypeAccordionProps) => {
return () => {
setTypes(type !== '' ? [type] : []);
setPageCursor(undefined);
setExpanded(false);
};
};

Expand Down

0 comments on commit 88d03d8

Please sign in to comment.