mantine
mantine copied to clipboard
Select onChange fires even when clicking the same element that's already selected.
Dependencies check up
- [X] 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:
- 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