Skip to content

fix(search): ExpandableSearch: collapsed-state tooltip label is hardcoded "Search" with no way to override it - #23080

Open
jadamski02 wants to merge 1 commit into
carbon-design-system:mainfrom
jadamski02:jadamski02-23076_fix_expandable_search_tooltip
Open

fix(search): ExpandableSearch: collapsed-state tooltip label is hardcoded "Search" with no way to override it#23080
jadamski02 wants to merge 1 commit into
carbon-design-system:mainfrom
jadamski02:jadamski02-23076_fix_expandable_search_tooltip

Conversation

@jadamski02

@jadamski02 jadamski02 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Closes #23076

Add expandButtonLabelText prop to Search / ExpandableSearch to allow localising the collapsed-state tooltip label.

Changelog

New

  • Search / ExpandableSearch: added expandButtonLabelText prop (default: "Search") to override the tooltip shown over the magnifier button when collapsed

Testing / Reviewing

  1. Render <ExpandableSearch expandButtonLabelText="Suche" />, hover over the magnifier button while collapsed and confirm the tooltip reads "Suche" instead of "Search"
  2. Render without the prop to confirm the tooltip still defaults to "Search"
  3. Run yarn test --testPathPatterns="Search-test" - all 73 tests pass
  4. Run yarn test --testPathPatterns="ExpandableSearch-test" - all 17 tests pass

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples
  • Followed the
    required v12 migration documentation
    for any code change that affects v12, or struck through this item because
    the PR does not affect v12
  • Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@jadamski02
jadamski02 requested a review from a team as a code owner August 21, 2026 18:56
@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for v12-carbon-react ready!

Name Link
🔨 Latest commit fbf975c
🔍 Latest deploy log https://app.netlify.com/projects/v12-carbon-react/deploys/6a88d007c8d8110008a35c93
😎 Deploy Preview https://deploy-preview-23080--v12-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for v12-carbon-web-components ready!

Name Link
🔨 Latest commit fbf975c
🔍 Latest deploy log https://app.netlify.com/projects/v12-carbon-web-components/deploys/6a88d00702fbc30007865b41
😎 Deploy Preview https://deploy-preview-23080--v12-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit fbf975c
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/6a88d007d54e2200072146f9
😎 Deploy Preview https://deploy-preview-23080--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit fbf975c
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/6a88d0073500500008349083
😎 Deploy Preview https://deploy-preview-23080--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit fbf975c
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/6a88d0070588550008d19558
😎 Deploy Preview https://deploy-preview-23080--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@jadamski02
jadamski02 force-pushed the jadamski02-23076_fix_expandable_search_tooltip branch 2 times, most recently from f425dcc to bd3ad14 Compare August 21, 2026 19:04
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.49%. Comparing base (f5631b6) to head (fbf975c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #23080      +/-   ##
==========================================
+ Coverage   89.80%   90.49%   +0.68%     
==========================================
  Files         626      271     -355     
  Lines       55608    40643   -14965     
  Branches     7954     2234    -5720     
==========================================
- Hits        49940    36780   -13160     
+ Misses       5522     3845    -1677     
+ Partials      146       18     -128     
Flag Coverage Δ
main-packages ?
web-components 90.49% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +52 to +56
/**
* Specify the label for the expand button in ExpandableSearch (collapsed state tooltip).
* Use this prop to provide a localised string in place of the default "Search" label.
*/
expandButtonLabelText?: 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.

Did you explore using the existing translateWithId pattern for this internal tooltip string instead of adding a new expandButtonLabelText prop? Other components (e.g., ProgressIndicator, DataTable) use translation IDs for built in labels, which would support localization without adding another component level label prop. If not, I'd suggest considering this approach.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I noticed that Search component is using an individual prop closeButtonLabelText, so I followed this pattern.
On the other hand,ListBoxMenuIcon (used by e.g. ComboBox) uses translateWithId with close.menu / open.menu IDs.
Introducing translateWithId here alongside closeButtonLabelText feels inconsistent within the same component - should closeButtonLabelText be deprecated in favour of translateWithId as well? Happy to go either way, just want to keep it consistent.

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.

should closeButtonLabelText be deprecated in favour of translateWithId as well?

Sounds like the right move to me. I'm not sure if others have different opinions.

@adamalston adamalston 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.

#23076 (comment):

The v12 migration checklist item is checked, but I don't see a corresponding update to docs/migration/v12.md. Am I missing something?

@jadamski02

Copy link
Copy Markdown
Contributor Author

#23076 (comment):

.github/PULL_REQUEST_TEMPLATE.md checklist

The v12 migration checklist item is checked, but I don't see a corresponding update to docs/migration/v12.md. Am I missing something?

@adamalston you're right, sorry for the confusion - I checked that by mistake instead of striking it through. I've updated the checklist.

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.

[Bug]: ExpandableSearch: collapsed-state tooltip label is hardcoded "Search" with no way to override it

2 participants