Replies: 5 comments 8 replies
-
Any official solution sounds desirable. Some of the workarounds in #1236 are incredibly hacky and break accessibility in very creative ways. |
Beta Was this translation helpful? Give feedback.
-
Hey! Thank you for your suggestion! I moved it to a discussion since it is a feature request and not really a bug. You can already do it by using the |
Beta Was this translation helpful? Give feedback.
-
Regarding #2035. I agree that just exposing openCombobox isn't a perfect solution either, however this kind of implementation is being used multiple times already in headlessui, so it should be already somewhat familiar. I also think it's important to keep in mind how hacky the workarounds that are currently being used are. Another option would be a prop on the ComboboxInput like 'openOnFocus'. That wouldn't give full control but at least resolve most of the issues outlined in #1236. @RobinMalfait Are there any other solutions that have been thought about? I'd really love to get rid of that invisible button in our project 😄 |
Beta Was this translation helpful? Give feedback.
-
Here's the workaround solution you referenced with Typescript in case anyone needs it.
|
Beta Was this translation helpful? Give feedback.
-
The best way I found for me is just nesting the input within the button component: <Combobox.Button className="w-full" as="div">
<Combobox.Input
className={/*...*/}
onChange={/*...*/}
displayValue={/*...*/}
/>
<div className={/*...*/}>
<ChevronDownIcon
className={/*...*/}
aria-hidden="true"
/>
</div>
</Combobox.Button> If you style them appropriately, this works well. Did not notice issues, yet. No need for EDIT: Added |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
As per the discussion in #1236 even if
Combobox.Option
s are immediately provided to the combobox, they aren't shown until you start typing or press the arrow keys. In my case (and seemingly many other cases) we would like to show options immediately, the same ones as if you pressed the arrow key or typed something and then deleted it. There are proposed workarounds likebut these seem needlessly brittle and convoluted. Adding a property to
Combobox
allowing you to see options immediately seems like the reasonable solution.Beta Was this translation helpful? Give feedback.
All reactions