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

Select onChange fires even when clicking the same element that's already selected. #6468

Open
1 of 2 tasks
mkf62 opened this issue Jun 27, 2024 · 0 comments
Open
1 of 2 tasks
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)

Comments

@mkf62
Copy link

mkf62 commented Jun 27, 2024

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.10.2

What package has an issue?

@mantine/core

What framework do you use?

Next.js

In which browsers you can reproduce the issue?

Chrome

Describe the bug

When you load a Select component with options and select one, if you select the same one that's already selected, it will fire an onChange event and I don't think that's normal behavior for a Select since the value is not actually changing. I tried it using both the regular format and the object format, both using a controlled Select component.

To reproduce:

  1. In the codesandbox provided, select "Item 1" in one of the Select components at least twice in a row. The onChange event will write a message to the console each time.

The codesandbox is in 7.11.0 version of Mantine, but my personal repo where I was seeing the issue is v7.10.2.

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

https://codesandbox.io/p/sandbox/allow-deselect-broken-mantine-rfdxwg

Possible fix

No response

Self-service

  • I would be willing to implement a fix for this issue
rtivital added a commit that referenced this issue Jun 28, 2024
…selected if it has been picked from the dropdown (#6468)
@rtivital rtivital added the Fixed patch Completed issues that will be published with next patch (1.0.X) label Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)
Projects
None yet
Development

No branches or pull requests

2 participants