Skip to content

SearchableChipSelect: Use a single string for the chips toolbar label - #87219

Open
lazerg wants to merge 3 commits into
WordPress:trunkfrom
lazerg:fix/issue-87218
Open

lazerg wants to merge 3 commits into
WordPress:trunkfrom
lazerg:fix/issue-87218

Conversation

@lazerg

@lazerg lazerg commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What?

Closes #87218

Use a single Selected items string for the SearchableChipSelect chips toolbar label instead of _n( 'Selected item', 'Selected items' ).

Why?

_n() is for strings that contain the number. Here the number was only used to pick between a generic singular and plural, which breaks in languages with more than two plural forms or where the form for 1 is also used for other numbers. The count is already announced in the input hint (%d items selected...), so the toolbar name doesn't need it.

How?

getChipsToolbarLabel() now returns __( 'Selected items' ) when something is selected. Tests that looked for Selected item with one chip now look for Selected items.

Testing Instructions

  1. Run npm run storybook:dev and open Components → @wordpress-ui → Form → SearchableChipSelectControl → Default.
  2. Select one item and inspect the chips. The toolbar should be named Selected items.
  3. Clear all chips. The toolbar should have no name.

Testing Instructions for Keyboard

  1. Focus the search input, select one item with Enter, move the caret to the start and press Left Arrow. A screen reader should announce the Selected items toolbar.

Use of AI Tools

Claude Code helped write the fix.

@lazerg
lazerg requested a review from a team as a code owner November 23, 2026 01:49
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @lazerg.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: lazerg.

Co-authored-by: tobifjellner <tobifjellner@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

@github-actions github-actions Bot added the [Package] UI /packages/ui label Nov 23, 2026
@github-actions
github-actions Bot requested review from aduth and ciampo November 23, 2026 01:49

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] UI /packages/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect use of _n() in WP 7.2

1 participant