also call onToggle on open changed (#33813)

fixes: #31415

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-10-25 15:21:56 +02:00 committed by GitHub
parent c4d6979907
commit 624817bdc1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,7 +55,9 @@ export const SingleSelect = ({
}}
{...props}
onClick={toggle}
onOpenChange={(isOpen) => setOpen(isOpen)}
onOpenChange={(isOpen) => {
if (isOpen !== open) toggle();
}}
selected={selections}
onSelect={(_, value) => {
onSelect?.(value || "");