mantinedev / mantine

A fully featured React components library
https://mantine.dev
MIT License
26.79k stars 1.9k forks source link

ComboBox Popover not closing on external click anymore #7057

Closed vektorblake closed 4 hours ago

vektorblake commented 2 weeks ago

Dependencies check up

What version of @mantine/* packages do you have in package.json?

7.13.4

What package has an issue?

@mantine/core

What framework do you use?

Next.js

In which browsers you can reproduce the issue?

All

Describe the bug

The dropdown in the Combobox used to expectedly close when a user clicked outside of it. As of 7.13.0, it no longer did so. For our case we added a manual store.closeDropdown in onClose to resolve it, but this wasn't needed before and seems unusual.

<Combobox
    store={combobox}
    onClose={combobox.closeDropdown}
    withinPortal={false}
    onOptionSubmit={handleOptionSelection}
    style={{ ...props.style }}
    {...props.comboboxProps}
>
    <Combobox.Target {...props.targetProps}>
        <TextInput
            onClick={() => combobox.toggleDropdown()}
                        {/* .... etc ..... */}
        />
    </Combobox.Target>

    <Combobox.Dropdown>
        <Combobox.Options>
            {options.length > 0 ? options : <Combobox.Empty>Nothing found....</Combobox.Empty>}
        </Combobox.Options>
    </Combobox.Dropdown>
</Combobox>

That was based on 716194c2c6497d8a507bfb25cf00c2f1dfa87c1b .

If possible, include a link to a codesandbox with a minimal reproduction

No response

Possible fix

No response

Self-service

rtivital commented 1 week ago

Please provide a sandbox with a minimal reproduction

yverby commented 1 week ago

This issue seems to have appeared after this commit Below is an example using Popover component and useDisclosure hook with the latest version of @mantine/core (7.13.5)

https://stackblitz.com/edit/github-zmfexg

rtivital commented 1 week ago

It is not related to Combobox, see https://github.com/mantinedev/mantine/issues/7019 about Popover

rtivital commented 4 hours ago

I cannot reproduce the issue on my side with the latest version, you are welcome to reopen the issue if you can provide a reproduction.