Skip to content

Selected SelectOption does not honor isDisabled attribute #3707

@romanblanco

Description

@romanblanco

Describe the issue. What is the expected and unexpected behavior?

While the option is set as disabled, it's still possible to remove it from the list of selected items

Screenshot_2020-02-10 CodeSandbox

Please provide the steps to reproduce. Feel free to link CodeSandbox or another tool.

  1. Open CodeSandbox for Multiple Select
  2. Set an option as disabled and add it in selected:
    this.state = {
      options: [
        { value: 'Alabama', disabled: true },
        { value: 'Florida', disabled: false },
        { value: 'New Jersey', disabled: false },
        { value: 'New Mexico', disabled: false },
        { value: 'New York', disabled: false },
        { value: 'North Carolina', disabled: false }
      ],
      isExpanded: false,
      selected: ['Alabama'],
      isCreatable: false,
      hasOnCreateOption: false
    };
  1. Refresh CodeSandbox brower

Alabama option can not be added anymore from the list of option, but still can be removed from the selected list.

On Chip object itself, this is possible to set by isReadOnly attribute.

Is this a bug or enhancement? If this issue is a bug, is this issue blocking you or is there a work-around?

Either bug or isReadOnly possibility is missing.

What is your product and what release version are you targeting?

ansible/ansible-hub-ui#94 (comment)

Comments

I've also tried to use isPlaceholder attribute. This did not help either.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions