mantine icon indicating copy to clipboard operation
mantine copied to clipboard

MultiSelect - a regression makes the MultiSelect unusable in some circunstances

Open Stouffi opened this issue 3 years ago • 1 comments

What package has an issue

@mantine/core

Describe the bug

This is a regression as the same symptoms mentioned in #2059 are obtained for the same props given to MultiSelect

This new issue may have been introduced by this commit https://github.com/mantinedev/mantine/commit/80176313c6a5c58aee2bcc6917e79c293e36af7d

This line https://github.com/mantinedev/mantine/blob/5.4.0/src/mantine-core/src/MultiSelect/MultiSelect.tsx#L333 makes the dropdown close immediately after focus if the filteredData array is empty. By default the defaultFilter returns false for any selected item, thus making the filteredData empty when all items are selected.

One workaround is to provide a filter that will return always true and to manage filtering outside of the component.

What version of @mantine/hooks page do you have in package.json?

5.4.0

If possible, please include a link to a codesandbox with the reproduced problem

https://codesandbox.io/s/repro-multi-select-dropdown-5-4-0-h1jsnj

Do you know how to fix the issue

No response

Are you willing to participate in fixing this issue and create a pull request with the fix

No response

Possible fix

No response

Stouffi avatar Sep 20 '22 07:09 Stouffi

@achmurali maybe related to issue reported on Discord

rtivital avatar Sep 20 '22 10:09 rtivital

My use case is slightly different because i'm doing some network calls with the multi select, but i'm going to leave this here because I think the dropdown bug is related. I really hope this can be resolved. Mantine releases so many new features, and I would hate to have to lock this version to 5.2.7.

This behavior repros on > v5.2.7 https://codesandbox.io/s/mantine-async-multiselect-repro-xdw1r9?file=/src/App.tsx

Expected v5.2.7

expected

Actual > v5.2.7

actual

teaguestockwell avatar Sep 25 '22 08:09 teaguestockwell