Combobox with disabled options without building combobox from scratch? #1125
-
Hi! I'm trying to use the Paste Combobox with some dropdown options disabled. Is it possible to achieve that with just the Combobox component or would I need to do it similarly to this and build out everything like in this example? https://paste.twilio.design/primitives/combobox-primitive The options I'm trying to disable would be "Loading..." & "No results found." (trying to make it an async combobox and update the options with a prefix search) I've tried using getItemProps from useCombobox and passing it into optionsTemplate but it looks like it doesn't disable the options there (and I'm also getting an error about missing props).
Thanks in advance for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @productdana In this instance you don't need a disabled state for listbox options for those two specific use cases. The reason being is that you need to be able to communicate those two states to users who use assistive technology such as screen readers. When something is disabled it is non-interactive. You can't focus on it, you can't select it, it's effectively removed from the DOM. As such you can't communicate to assistive technology these states of loading, or empty. They must remain enabled for me to get to them. Generally speaking because of the disabled logic, there isn't much of a concept of disabled options in a combobox. If you can't get to them, and you can't select them, you should ideally just remove them from the list. Hope that helps |
Beta Was this translation helpful? Give feedback.
Hi @productdana
In this instance you don't need a disabled state for listbox options for those two specific use cases. The reason being is that you need to be able to communicate those two states to users who use assistive technology such as screen readers.
When something is disabled it is non-interactive. You can't focus on it, you can't select it, it's effectively removed from the DOM. As such you can't communicate to assistive technology these states of loading, or empty. They must remain enabled for me to get to them.
Generally speaking because of the disabled logic, there isn't much of a concept of disabled options in a combobox. If you can't get to them, and you can't select them, y…