Skip to content

fix(core): forward search dropdown labels from the CMS - #3600

Merged
lariciamota merged 4 commits into
devfrom
fix/search-dropdown-cms-labels
Nov 19, 2026
Merged

lariciamota merged 4 commits into
devfrom
fix/search-dropdown-cms-labels

Conversation

@lariciamota

@lariciamota lariciamota commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What's the purpose of this pull request?

The search dropdown can't be translated. "Top Search" and "History" ignore the titles set in the CMS (Navbar > searchInput), and "Suggested Products" and "Clear History" have no CMS field at all, so stores in non-English locales always show these four labels in English.

The first part is a regression: since #3334 (released in v4.4.0), SearchInput no longer destructures searchTopTitle/searchHistoryTitle. They fall into ...otherProps, end up on the <input> as HTML attributes (searchtoptitle="..."), and <SearchDropdown> renders without them.

How it works?

  • SearchInput destructures the dropdown labels again (searchTopTitle, searchHistoryTitle and loadingLabel, which was dropped in the same refactor and left the loading text empty) and forwards them to SearchDropdown, so they no longer leak to the <input>.
  • New optional CMS fields on the Navbar searchInput (in sections.json, schema.json and cms_component__navbar.jsonc):
    • searchProductsTitle (default "Suggested Products"), passed as title to SearchProducts
    • searchHistoryClearLabel (default "Clear History"), passed as clearLabel to SearchHistory
  • The searchTopTitle CMS default now matches the component ("Top Search" instead of "Top search").
  • NavbarProps['searchInput'] and SearchInputProps get the two new optional props. This is additive only: nothing changes for stores that don't set them, since @faststore/components keeps its English defaults.

How to test it?

  • Set the four labels in the CMS (Navbar > Search Input), open the search dropdown and check that the titles and the clear button use the CMS values.
  • Inspect the search <input>: it should no longer carry searchtoptitle/searchhistorytitle attributes.
  • Unit tests: cd packages/core && pnpm vitest run test/components/search. The new label tests in SearchInputComponent.test.tsx and SearchDropdown.test.tsx fail on dev and pass here.

Starters Deploy Preview

Use the CodeSandbox build from this PR.

References

🤖 Generated with Claude Code

The SearchInput stopped forwarding `searchTopTitle` and
`searchHistoryTitle` to the SearchDropdown (regression from #3334), so
the CMS values ended up as attributes on the <input> and the dropdown
always rendered the English defaults.

Also add `searchProductsTitle` and `searchHistoryClearLabel` to the
Navbar searchInput CMS schema so "Suggested Products" and
"Clear History" can be translated too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lariciamota
lariciamota requested a review from a team as a code owner November 18, 2026 18:57
@lariciamota
lariciamota requested review from gabpaladino and removed request for a team November 18, 2026 18:57
@lariciamota lariciamota added the bug Something isn't working label Nov 18, 2026
@lariciamota lariciamota added the bug Something isn't working label Nov 18, 2026
…tests

- Forward `loadingLabel` from SearchInput to SearchDropdown; it was
  dropped in the same refactor and the loading text rendered empty.
- Align the `searchTopTitle` CMS default with the component ("Top Search").
- Move the SearchInput label tests into SearchInputComponent.test.tsx and
  add a SearchDropdown test for title/clear label forwarding.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dk-pr-review

dk-pr-review Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

DK Review — Audit Summary

Verdict: ✅ CLEAN

Severity Count
BLOCK 0
RESTRICT 0
SUGGEST 1

Only BLOCK and RESTRICT findings anchored to a changed line are commented inline on the diff. The finding below opens no review thread.

Scenarios evaluated: feature-flags, general-review
Scenarios skipped: dependency-governance (no matching files), pipeline-config (no matching files), agent-skills-review (no matching files), quality-ratchet (no matching files)


📋 Findings (1)

SUGGEST

  1. [Functional.LargerDefect] packages/core/cms/faststore/schema.json:2067 — The default copy for searchTopTitle changes from "Top search" to "Top Search". This default string may be referenced elsewhere (e2e/Cypress specs, snapshot tests, translation files) that aren't part of this diff and wouldn't be caught by the added unit tests, which only check prop-forwarding, not rendered text.
    → Grep the repo (especially packages/core/cypress) for the literal string "Top search" to confirm no test or downstream consumer still depends on the old casing.

DK Review v1.0.0 | To contest a finding, reply in its thread

@pkg-pr-new

pkg-pr-new Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@faststore/api

npm i https://pkg.pr.new/vtex/faststore/@faststore/api@ff9fb58

@faststore/cli

npm i https://pkg.pr.new/vtex/faststore/@faststore/cli@ff9fb58

@faststore/components

npm i https://pkg.pr.new/vtex/faststore/@faststore/components@ff9fb58

@faststore/core

npm i https://pkg.pr.new/vtex/faststore/@faststore/core@ff9fb58

@faststore/diagnostics

npm i https://pkg.pr.new/vtex/faststore/@faststore/diagnostics@ff9fb58

@faststore/lighthouse

npm i https://pkg.pr.new/vtex/faststore/@faststore/lighthouse@ff9fb58

@faststore/sdk

npm i https://pkg.pr.new/vtex/faststore/@faststore/sdk@ff9fb58

@faststore/ui

npm i https://pkg.pr.new/vtex/faststore/@faststore/ui@ff9fb58

commit: ff9fb58

lariciamota and others added 2 commits November 18, 2026 16:07
Addresses the Sonar "props should be read-only" rule on the components
touched by this change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Addresses the Sonar "Mark the props of the component as read-only" issue
reported on SearchDropdown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sonar-workflows

Copy link
Copy Markdown

@hellofanny hellofanny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! 🚀

sort: string
submitButtonAriaLabel?: string
searchHistoryTitle?: string
searchHistoryClearLabel?: string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

niceeee!

@lariciamota
lariciamota merged commit 0f18b72 into dev Nov 19, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants