spectrum-web-components
spectrum-web-components copied to clipboard
[Feat]: Extend ComboboxOption to support disabled state of menu items
Code of conduct
- [X] I agree to follow this project's code of conduct.
Impacted component(s)
Combobox
Description of the requested feature
As a user I'd like to disable certain items in a combobox so I can see that those values/items exists, but aren't selectable.
Mockups or screenshots
Implementation notes or ideas
Extend Combobox options with boolean param: disabled , see: https://github.com/adobe/spectrum-web-components/blob/a2b6bea7142930d8143d9ca887e2c56ffa71a669/packages/combobox/src/Combobox.ts#L45
such as
export type ComboboxOption = {
value: string;
itemText: string;
disabled: boolean;
};
and map that disabled state to related menu-item. Check if selection process will still work and disabled menu item won't be selected when user presses keyUp/keyDown.