Repository navigation
Conversation
…ons j:KIT-3954 The "Recent searches / Clear" item was the first entry of the suggestion list, so pressing the Down arrow landed on it instead of on the first suggestion announced by screen readers. atomic-search-box and atomic-commerce-search-box now render a "Clear recent searches" button below the suggestion panels. While suggestions are open, Tab in the search box focuses the button, Shift+Tab or Escape returns to the search box, and the focus goes back to the search box once the recent queries are cleared. SearchBoxSuggestions gains an optional renderActions() method so suggestion components can render buttons below the panels. The recent-query-title-item, recent-query-title-content and recent-query-title parts were removed; recent-query-clear is now on the new button, and suggestions-actions / suggestions-action parts were added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 59585eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
@coveo/atomic
@coveo/atomic-hosted-page
@coveo/atomic-legacy
@coveo/atomic-react
@coveo/bueno
coveo.analytics
@coveo/create-atomic-rollup-plugin
@coveo/headless
@coveo/headless-react
@coveo/quantic
@coveo/relay
@coveo/shopify
@coveo/atomic-angular
commit: |
|
Tip All tests passed and all changes approved!🟢 UI Tests: 471 tests unchanged |
Keep the clear option as a regular suggestion element produced by the recent queries components, and let atomic-search-box and atomic-commerce-search-box render it as a button below the suggestions. This drops the renderActions hook, the SearchBoxSuggestionAction type, the suggestion manager changes, the new shared renderer and the fixture changes. Tab no longer closes the suggestions while the button is displayed, so the focus continues in the natural order up to the button. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Note
Copilot was unable to run its full agentic suite in this review.
Copilot review overview
Review effort: Lite
Findings: 3
Open (5)
Same issue as inatomic-search-box: ifelement.onSelectis async, it is not awaited here, which… · New Using@mousedowntopreventDefault()won’t catch touch/pointer interactions (e.g.,… · New Ifelement.onSelectis async (returns a Promise), it’s currently not awaited, which can cause… · NewclearRecentQueriesElementperforms a.find(...)overallSuggestionElementsand is queried… · NewclearRecentQueriesElementperforms a.find(...)overallSuggestionElementsand is queried… · New
What changed in this PR
This PR moves the “Clear recent searches” affordance out of the suggestions list for both atomic-search-box and atomic-commerce-search-box, rendering it as a dedicated button below the suggestions and updating related parts, selectors, and tests.
Changes:
- Render a dedicated “Clear recent searches” button below suggestions (and exclude it from suggestion panels / keyboard list navigation).
- Adjust keyboard behavior so
Tabno longer closes suggestions while the clear button is present. - Update recent-queries suggestion model/parts and refresh unit + e2e tests accordingly.
| File | Description |
|---|---|
| packages/atomic/src/components/search/atomic-search-box/e2e/page-object.ts | Updates selector for the clear-recent button to use role/name. |
| packages/atomic/src/components/search/atomic-search-box/e2e/atomic-search-box.e2e.ts | Updates e2e flow to focus/activate the clear button via keyboard. |
| packages/atomic/src/components/search/atomic-search-box/atomic-search-box.ts | Renders clear button below suggestions, filters it out of panels, adjusts Tab behavior, updates parts doc. |
| packages/atomic/src/components/search/atomic-search-box/atomic-search-box.spec.ts | Adds unit tests for new clear-button placement/behavior. |
| packages/atomic/src/components/common/suggestions/recent-queries.ts | Introduces helper to detect clear element; updates clear element parts/content. |
| packages/atomic/src/components/common/suggestions/recent-queries.spec.ts | Updates/extends specs for new clear element part/content + predicate. |
| packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/page-object.ts | Updates selector for the clear-recent button to use role/name. |
| packages/atomic/src/components/commerce/atomic-commerce-search-box/e2e/atomic-commerce-search-box.e2e.ts | Updates e2e flow to focus/activate the clear button via keyboard. |
| packages/atomic/src/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.ts | Mirrors search-box changes: render button below, filter out of panels, adjust Tab behavior, update parts doc. |
| packages/atomic/src/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.spec.ts | Adds unit tests for new clear-button placement/behavior. |
| packages/atomic/src/components/commerce/atomic-commerce-search-box-recent-queries/e2e/page-object.ts | Updates selector for clear button to use role/name. |
| packages/atomic/src/components/commerce/atomic-commerce-search-box-recent-queries/atomic-commerce-search-box-recent-queries.spec.ts | Updates specs to reflect new part and removed properties/structure. |
| .changeset/recent-queries-clear-button.md | Documents the behavior/parts change as a minor bump. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
…operty j:KIT-3954 Moving the clear option out of the list changes documented shadow parts, which is a breaking change. Keep the current behavior by default, and add the enable-clear-recent-queries-button property to atomic-search-box and atomic-commerce-search-box to render a "Clear recent searches" button below the suggestions instead. When the property is set, Tab no longer closes the suggestions while the button is displayed, and clicking the button clears the recent queries and focuses the search box again. The recent queries components and their helpers are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| * The button is reached with the Tab key, so the arrow keys only navigate through the suggestions. | ||
| */ | ||
| @property({ | ||
| type: Boolean, |
There was a problem hiding this comment.
Have you considered making this an enum between different options – defaulting to the current behaviour – rather than a boolean?
Something like clearRecentQueriesButtonPosition:
NONEFIRST_RESULTLAST_RESULTAFTER_RESULTS
There was a problem hiding this comment.
I don't think this is the right approach because this PR's goal is to have the button at the end of the suggestion (which is clearly the most coherent behaviour).
Giving the choice for weird button placement would open the door to bad UX
There was a problem hiding this comment.
Kept the boolean: the button below the suggestions is the only layout that fixes the issue, since FIRST_RESULT and LAST_RESULT keep the option inside the list (arrow keys land on it, screen readers count it as a suggestion) and NONE would remove the ability to clear your own history. The flag only bridges until v4, where the TODO - (v4) KIT-4365 makes the button the only behavior, so an enum would carry the weaker options forward.
🤖 Addressed by Claude Code
…recent-button j:KIT-3954 Use the shorter with-* naming that Atomic uses for opting into extra UI, like with-date-picker and with-search. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Waiting for UX |
…r recent queries button j:KIT-3954 With with-clear-recent-button set, focus can move to the button inside the suggestions, but Escape only worked from the search box. Pressing Escape on the button now closes the suggestions and focuses the search box again. Also use the path alias for the button import in the commerce search box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


KIT-3954
Problem
The "Recent searches / Clear" option is the first item of the suggestion list. A screen reader announces how many suggestions are available, but pressing the Down arrow lands on the clear option instead of the first suggestion. Moving it out of the list for everyone would remove documented shadow parts, which is a breaking change.
Solution
Add an opt-in

with-clear-recent-buttonproperty toatomic-search-boxandatomic-commerce-search-box. When it's set, the clear option is rendered as a "Clear recent searches" button below the suggestions, which can be styled with the newrecent-query-clear-buttonpart. Tab no longer closes the suggestions while the button is displayed, so keyboard users can reach it. Clicking it clears the recent queries and puts the focus back in the search box, and pressing Escape on it closes the suggestions.The default behavior and the recent queries components are unchanged.
Note
The property should become the default behavior in v4. It's marked with a
TODO - (v4) KIT-4365.