SearchableChipSelect: Add form primitive to @wordpress/ui - #80779
Conversation
|
Size Change: 0 B Total Size: 7.76 MB |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Doesn't need solving in this PR as it's a bit of an edge case, but likely would need a follow-up:
Reminded me about the need for a Truncation component (#77391). Depending on content, consumer might want to wrap or truncate in different ways, for example at the end vs in the middle for text/domains/emails. |
| onValueChange={ ( values: typeof ITEMS, event ) => { | ||
| if ( values.some( ( item ) => item.value === 'create' ) ) { | ||
| // eslint-disable-next-line no-alert | ||
| alert( `Create new item: '${ inputValue }'` ); |
There was a problem hiding this comment.
Just had a thought to use prompt() instead of alerting empty when nothing was entered, but how it's now is fine too for the sake of the demo.
simison
left a comment
There was a problem hiding this comment.
I'm not deeply familiar with combobox components (which I know can have lots of complexity) so you might want second thoughts, but overall this looks, feels and works well for me. I tested with Chrome & Firefox, desktop and mobile.
What should I expect from keyboard navigation for a component like this? Should each chip and "clear all" button be accessible by keyboard, or would I be expecting to navigate contents via the dropdown list only?
Design-wise only oddity to me is how when popover is above search input, it covers the chips and casts a shadow over search text:
...but also nice to have it with close proximity to search.
Below -version looks good as-is:
Co-authored-by: Mikael Korpela <mikael@ihminen.org>
We don't have an APG pattern for multiselect comboboxes unfortunately. But as I understand it, all features are accessible by keyboard, if not with the exact same mechanisms as a mouse. Chips are navigable by arrow keys, deletable by the delete key, and the Clear All function is available through the escape key. The Clear All button not being focusable is a bit quirky, but I guess that's how it works in a standard |
|
Looking forward to this. As an experiment, I migrated For async search, is there a plan to support a standardized way to handle "loading state"? Base UI suggests using |
Mm, thanks for the call out. I'll add them in. |
# Conflicts: # packages/ui/CHANGELOG.md
|
Flaky tests detected in 0ade97a. π Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/30542698930
|





What?
Adds a
SearchableChipSelectform primitive to@wordpress/ui.Why?
The design system needs a searchable multi-select control with chip-based selection state. This builds on the existing Combobox primitives and will support a higher-level control wrapper later.
How?
Add the
SearchableChipSelectprimitive, composingComboboxsubcomponents withInputLayoutfor the chip input chrome.Testing Instructions
Screenshots