-
Notifications
You must be signed in to change notification settings - Fork 1k
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鈥檒l 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 馃様 |
Please see the discussion above, it should answer any questions you have as well as how to build your own. If the ask is specifically for a React Spectrum TagField component, that should be moved to a different place. useCombobox is a specific aria pattern that will not be supporting multiple selection on its own. |
Now that Taggroup is released i would love to see a Tagfield / comboBox with multiple selection. |
NextUI just dropped their select component and it supports multi selection 馃憦馃徑 |
This project is using
but I'm eager to see it in |
Great find! I agree that it would be good to see it in RAC, but that's at least a good reference implementation if someone wants to build their own. Here's the source code for anyone interested: https://github.com/project44/manifest/tree/main/packages/react/src/components/MultiCombobox |
Thanks for the reference. I don't suppose you were able to replicate such a component with RAC? |
This comment left me confused because before you said that:
If I understand correctly, this is planned, but it would not be a Combobox functionality but rather a new input type called TagField, is that correct? If it's a name problem, perhaps this issue could be renamed instead of opening a new one :) |
@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 |
馃檵 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: