support listbox with multiple selection
I ported all the tests for the multi-select from https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/components/listbox/listbox.test.tsx
Let me know your feedback, please.
A couple more changes that this PR makes:
- we were not setting
aria-selected="false"on unselected options for listbox and combox (this differs from headlessui). This was fixed for listbox and combobox. - when we used
assertListboxOption({ selected: false }, we were not asserting anything with regards to the selected state of the option (neither the absence ofaria-selectedor the presence ofaria-selected="false). Not we're testing that the option hasaria-selected="false". This was fixed for listbox and combobox. -
tabindexshould only be-1if the option isn't disabled. This was fixed for listbox and combobox.
Hey @miguelcobain :wave:
I just want to let you know that, I am just in the process of simplification active / selected *guid usage in <Listbox/> component. As you already noticed (and changed!) in this PR selectedOptionGuid is not necessary to be kept in parent component, similar story is with activeOptionGuid. I think my PR will simplify a lot this one – as no need to juggle with selectedOptionIndexes.
Is there anything that needs to be done on this still or is it something that can be merged? I'm in need of multi-select support for the listbox and was going to fork this repo to get it. But I would love for this to actually be merged and released.
I would really love for this to get merged as I have a fork of this addon just for this PR. Is there any reason this can't be merged? Does it need updates before it can?
@NullVoxPopuli Is this something that can be merged?
There are conflicts, I'd say it's up to @GavinJoyce and @miguelcobain
Personally, my efforts are focused on not mimicking tailwind's patterns over here:
https://ember-primitives.pages.dev/