Open ctdunc opened 3 days ago
^7.6.2
@mantine/core
Other, I will specify in the bug description
All
I am using mantine through dash-mantine-components, but have confirmed that this issue also appears on the mantine website.
For example, given a tags input containing items=['a','b','a'], clicking delete on items[2] also deletes items[0].
items=['a','b','a']
items[2]
items[0]
https://mantine.dev/core/tags-input/#allow-duplicates
Clicking delete on a tag should delete only that tag.
Possibly here https://github.com/mantinedev/mantine/blob/00a94ceefc22c80ad08af73acb943f8f0c01d662/packages/%40mantine/core/src/components/TagsInput/TagsInput.tsx#L339
Maybe something like this? If duplicates aren't allowed, the behavior will be identical. If duplicates are allowed, it will only remove the desired element.
onRemove={() => { let _ = _value.splice(index, 1) setValue(_value); onRemove?.(item); }}
If this is expected behavior, ill close this issue. Otherwise happy to submit a fix, just let me know.
Thanks!
You are welcome to submit a PR with a fix
Dependencies check up
What version of @mantine/* packages do you have in package.json?
^7.6.2
What package has an issue?
@mantine/core
What framework do you use?
Other, I will specify in the bug description
In which browsers you can reproduce the issue?
All
Describe the bug
I am using mantine through dash-mantine-components, but have confirmed that this issue also appears on the mantine website.
For example, given a tags input containing
items=['a','b','a']
, clicking delete onitems[2]
also deletesitems[0]
.If possible, include a link to a codesandbox with a minimal reproduction
https://mantine.dev/core/tags-input/#allow-duplicates
Possible fix
Clicking delete on a tag should delete only that tag.
Possibly here https://github.com/mantinedev/mantine/blob/00a94ceefc22c80ad08af73acb943f8f0c01d662/packages/%40mantine/core/src/components/TagsInput/TagsInput.tsx#L339
Maybe something like this? If duplicates aren't allowed, the behavior will be identical. If duplicates are allowed, it will only remove the desired element.
Self-service