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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

SelectMenu closeOnSelect doesn't work with isMultiSelect #1521

Open
ahsan-sabir opened this issue Sep 16, 2022 · 3 comments
Open

SelectMenu closeOnSelect doesn't work with isMultiSelect #1521

ahsan-sabir opened this issue Sep 16, 2022 · 3 comments

Comments

@ahsan-sabir
Copy link

No description provided.

@brandongregoryscott
Copy link
Contributor

Looking at the code, I think this was intentional:

const handleSelect = useCallback(
item => {
if (isSelected(item) && isMultiSelect) {
onDeselect(item)
} else {
onSelect(item)
}
if (!isMultiSelect && closeOnSelect) {
close()
}
},
[onDeselect, isMultiSelect, closeOnSelect, onSelect, isSelected, close]
)

I'm thinking closing the select menu would lead users to believe they can only select one option, and they wouldn't reopen it to select another.

@ahsan-sabir
Copy link
Author

ahsan-sabir commented Sep 28, 2022

I see it's a feature not a bug 馃槃

"I'm thinking closing the select menu would lead users to believe they can only select one option, and they wouldn't reopen it to select another."

I don't think that would be a problem since it will only close with explicit closeOnSelect.
My particular use case involves making an expensive api req on each select, so I have to close the select menu and disable it until current req completes.

@brandongregoryscott
Copy link
Contributor

I don't think that would be a problem since it will only close with explicit closeOnSelect.

That's a good point. Looks like we don't default closeOnSelect to true, so this wouldn't break the existing behavior for consumers using the multi-select version, unless they were also trying to use both props together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants