Replies: 2 comments
-
Would you be willing to share a codesandbox or stackblitz with your implementation? it'd be a lot easier to help with that. Otherwise it's hard to tell exactly what's been done. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@apucacao I'm currently headed down this same path. Were you ever able to resolve the issue? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
I'm building a custom component that composes an
Input
with aListBox
in a similar fashion to theComboBox
, minus the built-in popover part, that supports all the selection modes. We're staying away from multi-select type UX alareact-select
by displaying values in aTagGroup
and selection driven by this autocomplete component in a popover (with a button trigger).I had built a version of this that had a frustrating shortcoming: pressing the Up/Down arrows didn't move selection in the list. After a bit of research here I found this comment which set me on a path to try and compose an input and a list box with virtual focus.
The problem I'm running into is that I can't get any items to populate my collection.
The component is inspired by the RAC
ComboBox
implementation, includinguseComboBox
,useComboBoxState
, etc…useListState
+useControlledState
AutoCompleteListBox
component then usesInputContext
,ListBoxContext
andListStateContext
And I'm trying out something like this:
The
AutoCompleteListBox
component itself looks like this:And the relevant part of
useComboBoxState
looks like this:Problem is the resulting
collection
is empty; I can tell thatuseListState
is receiving the items I expected though .One thing I've noticed is that
ComboBox
andSelect
render theirListBox
twice, the first time along with something called aCollectionDocumentContext
.Is that the thing I'm missing? Because from the looks of it I can't export that from the package. But maybe I'm missing something else. Happy to share more of the code if that helps.
Update: I tried copying
utils.tsx
andCollection.tsx
over from thereact-aria-components package, and followed the example from
ComboBoxby using
useCollectionDocumentand
Hidden` and co. but the collection still ends up empty.Beta Was this translation helpful? Give feedback.
All reactions