spectrum-web-components icon indicating copy to clipboard operation
spectrum-web-components copied to clipboard

[Feat]: Extend ComboboxOption to support disabled state of menu items

Open spdev3000 opened this issue 1 year ago • 0 comments

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

Screenshot 2024-09-19 at 18 17 11

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.

spdev3000 avatar Sep 19 '24 16:09 spdev3000