Skip to content
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

Search results pattern. #3766

Merged
merged 8 commits into from
Feb 21, 2025
Merged

Search results pattern. #3766

merged 8 commits into from
Feb 21, 2025

Conversation

humancompanion-usds
Copy link
Collaborator

@humancompanion-usds humancompanion-usds commented Jan 30, 2025

This just jumpstarts the template for search results. Ryan will hand us the Figma file that we can use to create a template in Figma. More to come on this but I'd like to get out what we have as a candidate.

@humancompanion-usds humancompanion-usds marked this pull request as ready for review February 12, 2025 22:33
@humancompanion-usds humancompanion-usds requested a review from a team as a code owner February 12, 2025 22:33
@humancompanion-usds humancompanion-usds self-assigned this Feb 12, 2025
@humancompanion-usds humancompanion-usds changed the title Draft of search results pattern. Search results pattern. Feb 19, 2025
@humancompanion-usds
Copy link
Collaborator Author

@danbrady - This is ready for your review. I also started the task of building out the templates, which I've linked to here in the front matter. You can review those at your leisure and @caw310 will give you all a ticket to complete those templates. Ryan has much of the work in the Design Gaps file, but there a number of variations to cover. I've annotated the ones in guidance that I thought were most relevant to start with.

anchors:
- anchor: About
- anchor: Examples
- anchor: Structure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Structure anchor doesn't go anywhere. It looks like we have two Structure sections: the Search Results Page and the Single Search result. Perhaps add both those links here instead? Or keep the "Structure" section and have "Search Result Page" and "Single Search Result" as sections with the Structure section?


### URL

The text of the link of the matching page. This should not be a link (the header is the link).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the benefit of showing the URL? Could that be awkwardly read out to screen readers? Perhaps the search breadcrumb could be more helpful than a URL? (At least for the global site search.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. We're basically just documenting what we do now. We just changed the color and placement. But we can discuss dropping it. I see Google has done that.

* **Uses filters when there are facets to filter by and when there is more than one page of results.** Filtering is not required but recommended in these scenarios:
* When there are categories of results (facets) returned AND
* Where there is more than 1 page of results (i.e results are not pre-determined to be limited to a short list of 10-20 items)
* **Use filter chips to show the filters being applied when there are more than 3 facets.** 3 or more facets requires the use of filter chips to show what is currently selected in filters.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filter chips

Is the idea to make these a new component? Does the page auto-update when a user clicks the "x"? Is there an accessibility issue with that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the intention is to create a new component for these. Amanda's team is working on testing it out very soon.

* **Use filter chips to show the filters being applied when there are more than 3 facets.** 3 or more facets requires the use of filter chips to show what is currently selected in filters.
* **Filters collapse inside an Accordion below table width.** At mobile viewports, up until the tablet breakpoint, filters should collapse inside an Accordion component.
* **Use a left-hand sidebar when the main purpose of the product is to search.** If your product's main purpose is to allow users to search, then use a persistent, visible, left side navigation from the tablet breakpoint and wider viewports. For example, global Search, GI Bill Comparison tool, and Resource & Support (or other knowledge bases) feature search, filtering, and sorting as the main focus of their products thus they would use a persistent side navigation to hold filtering.
* **Sort and filtering are not the same!** Do not conflate the Sort action with the Filter action. See [guidance on sort](#sort).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort and filtering are not the same!** Do not conflate the Sort action with the Filter action.

This exact line was mentioned in line 167 of the "How to design and build" section. Just confirming it's intentional here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. I put it in both places intentionally.

* **Sort and filtering are not the same!** Do not conflate the Sort action with the Filter action. See [guidance on sort](#sort).
* **Use a checkbox for filtering on multiple facets.** Multiple facet filtering uses the [Checkbox]({{ site.baseurl }}/components/form/checkbox) component as the interaction input.
* **Use a radio button when only one filter can be applied at a time.** If a facet only allows mutually exclusive results at a time, in other words only one filter can be applied at one time, then use the [Radio button]({{ site.baseurl }}/components/form/radio-button) component as the interaction input up to 5 items. For more than 5 items use a [Select]({{ site.baseurl }}/components/form/select) component.
* When there only 2-3 items within a facet that can be filtered on, use of a Segmented Button component is an option excluding task flows such as filling out a form, reviewing secure messages, etc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there are only 2-3 items...

Missing word

@humancompanion-usds humancompanion-usds merged commit 57e4a18 into main Feb 21, 2025
4 checks passed
@humancompanion-usds humancompanion-usds deleted the search-results-template branch February 21, 2025 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants