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

Combobox onClose does not work #5427

Closed
1 of 2 tasks
crabvk opened this issue Dec 15, 2023 · 3 comments · Fixed by #5509
Closed
1 of 2 tasks

Combobox onClose does not work #5427

crabvk opened this issue Dec 15, 2023 · 3 comments · Fixed by #5509

Comments

@crabvk
Copy link

crabvk commented Dec 15, 2023

Dependencies check up

  • I have verified that I use latest version of all @mantine/* packages

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

7.3.2

What package has an issue?

@mantine/core

What framework do you use?

Vite

In which browsers you can reproduce the issue?

Firefox

Describe the bug

I took the first code example from the Combobox examples page called "Basic select". Added onClose={() => alert('onClose')} to Combobox component. The event does not trigger when I close dropdown. onOpen works just fine though.

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

https://codesandbox.io/p/sandbox/infallible-leakey-5w99kk

Possible fix

No response

Self-service

  • I would be willing to implement a fix for this issue
@kartikm02
Copy link

I would be willing to fix this issue

kartikm02 added a commit to kartikm02/mantine that referenced this issue Dec 24, 2023
@ID-JA
Copy link
Contributor

ID-JA commented Jan 3, 2024

@rtivital
I've looked at the issue, and it seems like the onClose prop isn't being triggered even if we passed it as a prop for the Combobox component.

I've made a small adjustment to the Combobox.tsx file.

 <Popover
        opened={store.dropdownOpened}
        {...others}
-       onClose={store.closeDropdown}
+      onClose={onClose || store.closeDropdown}
        withRoles={false}
        unstyled={unstyled}
      >
        {children}
</Popover>

I've checked the Select component behaviour (it closed on clicking outside).

should I make a pull request?

@rtivital
Copy link
Member

rtivital commented Jan 3, 2024

You are welcome to submit a PR with a fix

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

Successfully merging a pull request may close this issue.

4 participants