Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Multiselect Controlled state is selecting disabled items #16445

Closed
2 tasks done
preetibansalui opened this issue May 13, 2024 · 2 comments · Fixed by #16477
Closed
2 tasks done

[Bug]: Multiselect Controlled state is selecting disabled items #16445

preetibansalui opened this issue May 13, 2024 · 2 comments · Fixed by #16477
Labels
component: multiselect severity: 3 User can complete task, and/or has a workaround type: bug 🐛

Comments

@preetibansalui
Copy link
Contributor

preetibansalui commented May 13, 2024

Package

@carbon/react

Browser

No response

Package version

v11.57.0

React version

No response

Description

In MultiSelect Controlled state, there is an example of selecting all items by clicking the 'Select all' button. On click to this button, it select all the items of list, including the disabled ones.
I understand that it's just an example to show user that they can pass their custom actions as a prop to select/deselect items, but selecting disabled items is wrong as an example to be present in storybook.

Please check my comment in original PR:

Reproduction/example

#16139 (comment)

Steps to reproduce

Go to Storybook > Multiselect > Controlled
On click to Select all button selects all items including disabled ones.
image

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

@ychavoya
Copy link
Contributor

Hello, if you agree, I am willing to help with a PR to change this example I added. It should be simple, just filter out the disabled options when clicking the select all button:

setSelectedItems(items.filter(item => !item.disabled))

@preetibansalui
Copy link
Contributor Author

@ychavoya : Sure, Please go ahead. Thanks for looking into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: multiselect severity: 3 User can complete task, and/or has a workaround type: bug 🐛
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants