-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple selection support for useComboBox #2140
Comments
We call this a tag field - a combination of a tag list and an input kinda like the "to" field in an email app. It's on the roadmap, but not sure when yet. We need to do some a11y research and testing to determine how best to implement it. |
@LFDanLu lazy ask, but is there a ticket created for the tag field that @devongovett mentioned? I'd like to follow it, so that I can see when react-aria lands support for it. Thanks! |
@stephenh I don't believe there is a ticket created for the tag field yet since it is still in its early germination phase unfortunately. https://github.com/adobe/react-spectrum/projects/1 is the best place to look regarding what is currently in flight. |
Going to keep this ticket open for tracking. |
Hey @devongovett , Does it look like similar to this? |
@devongovett |
Hey, @devongovett As I move forward trying to contribute to this task, I'm wondering if this use-case requires us to build another independent component/hook or this functionality could be incorporated into any existing component? |
Is there a way to achieve this behaviour with existing hooks in I'm working on a custom component library according to a design system and using From what I can see, some combination of a SelectionManager and ListBox looks like the most suitable approach |
This also matches my use case. Are we better off building something from scratch or is support for this use case on the near term roadmap? |
I was facing this problem regarding multiselect as well. Since So, instead of:
Basically it means a lot of copy-pasting and playing with properties of hooks underneath. Once I became more familiar with the original implementation I found it very flexible and customizable. |
Just an FYI that we are also on our way to building what was described in #2140 (comment) This is the PR where TagGroup work has been started |
@crazko are your multi select compatible hooks public by any chance? |
@donaldpipowitch let's check example at https://codesandbox.io/s/spectrum-multiselect-9be866-9be866. It is a simplified version of our There's a bug though, which I was not able to find a fix for so far; it is not present in our library. But should give enough input for how this may work. |
Thank you very much! |
Wondering if it will be possible to update the input (or contenteditable element) with a mix of values. My use case is an omni-search box that allows users to type random search strings, but as they type a menu can appear to offer them selections for tags, categories, and other meta data fields. If they make a selection (ex: tag), it should appear in the input field where their cursor was, allowing them to continue typing/selecting as they wish from there. |
If you are using our hooks to make your combobox, this should already be possible. I wouldn't actually update the input for mixed anything, but you could render anything you wanted before or after the combobox, then just make it visually look like it's part of the input. Combobox has no plans to support multi select. Instead, when multiselecting, remove selected items and put them outside the combobox, just like you're suggesting with the tags. |
@snowystinger Thanks for the hint. But from what you're describing I'm struggling to understand how a user would interact with the data they've entered. For example, say they enter the following: The quick But now they want to change the word "jumped" to "ran". How would it be possible if this was rendered outside of the input field (or contenteditable element)? |
hmmm have you tried tokenizing to words, and each word is a combobox? because it doesn't seem like the whole thing is one combobox. I'm not sure the accessibility implications of this approach, but I don't think it fits combobox otherwise at all. This is an, you're off the map, situation. Keep in mind, this https://www.w3.org/WAI/ARIA/apg/patterns/combobox/ is the aria pattern we have implemented.
|
@snowystinger Got it. Thanks for the explanation. I think you're right in that it might be some hybrid pattern. Appreciate your feedback. |
Hi, yesterday I was also looking for this. I was able to do an autocomplete + tags using Basically I reimplemented |
@andresgutgon Could you kindly share your implementation? I'm struggling with this |
It's still in the oven, but when I have time I'll share a sandbox with the parts. |
@wporoslo sorry for the delay. I made a very ugly version of the one we built But the parts necessary to do a combobox + multiple selection are there |
|
Is there any status on this issue? This is a very important feature that we are waiting for 😔 |
@GermanJablo your assessment is correct. I'm a little wary of changing the name of the issue because people do search for it a lot and if it said "TagField", I fear we'd get a lot of new issues opened. The only reason for a new issue I feel would be for the React Spectrum implementation, since we'd be building and styling that. |
Oh, I understand. This design pattern seems to rely a lot on CSS compared to the rest of the RACs. |
Hi! I'm interested in this implementation and think having a specification similar to what's detailed in the following issues would be helpful during development. Currently, it seems there isn't a detailed spec for this component, and I'm eager to learn more about any research or preliminary considerations you might have at this point, even if it's just in note form. For example, I'm curious about concepts like moving the cursor between tags, as mentioned in Devon's post. |
There are a few problems with existing hook combinations that I'd like to introduce. 1. Unavailability of
|
Thanks for having a think about this!
Let us know if you have more questions or think of something else. |
Is it correct to understand that the drop-down list of the ComboBox will not support use cases where selected items are displayed within the list? |
Yes, that's correct |
Hi @snowystinger, is there any chance some hook/context like |
Hey @6thpath, could you please share your code on StackBlitz? We can manually patch |
Hi @sadeghbarati, sorry for the late reply, there're more than |
@stephenh Hit the upload limit in Stackblitz so I create a GitHub repo for creating demo in Stackblitz Exported functions and components
|
https://stackblitz.com/edit/github-qwxduv I updated the manual package file with the latest changes in main branch, can you guide us here how to use that |
Hey team, we'd love to see this implemented for our usage. Is there any way we can prio this ? Via a bounty or anything ? |
Just wondering, is this still the team's stance on multi-select support within ComboBox in React Aria? My experience with trying to implement this in user-land has been nothing but frustrations and headache. |
At some point we'll tackle a TagField, which would fulfill that functionality. However, Combobox has no plans to support multi-select, see #2140 (comment) about the combobox aria pattern. |
Thanks for the reply @snowystinger - I see. Hate to ask, but has the TagField been prioritized at all? Just wondering what kind of time frame we're looking at here. Appreciate the info! |
I found these sources
|
@mryechkin we are waiting on our design team to redesign the component (scheduled likely for later this year) before engineering picks up the component for implementation |
Hi, is there maybe an update on this? |
@romansndlr our design team has picked up the TagField component from their backlog this month and has begun working through specifications, with designs to follow; in the meantime, our implementation is still on hold, but stay tuned 🤞 |
That's amazing! Thank you guys so much. Would love it if y'all could keep us updated here on any advancements |
🙋 Feature Request
Update useComboBox to support multiple selection.
🔦 Context
We're building a type-ahead
SelectField
/MultiSelectField
components, both on top ofuseComboBox
and having to support multiple selections is of course making us do some hacky things, b/c it's not really supported.I.e. we're not passing
selectedKey
touseComboBox
b/c in a multiple selection scenario, theselectedKey
could change, and so then odd things happen whereuseComboBox
thinks its not controlled and/or theselectedKey
!==inputValue
, so it invokes various closing/reset behavior that we didn't mean to trigger.Obviously this is on us for misusing
useComboBox
:-D , so just filing a request / wish list for it to get official multiple selection support. Thanks!The text was updated successfully, but these errors were encountered: