ui icon indicating copy to clipboard operation
ui copied to clipboard

[Bug]: Select behaviour with duplicate values

Open asontha opened this issue 1 year ago • 2 comments

Describe the bug

I have a use case where users select a state abbreviation and that maps to specific fine print that needs to be used for that state. Many times the states have similar fine print but some have very specific fine print. Users also don't need to know the specific fine print to be using, just the state who's fine print they want to use.

Affected component/components

Select

How to reproduce

Create a select component with multiple keys that have the same value.

Selecting one of those keys selects all of the keys with the same value.

Codesandbox/StackBlitz link

No response

Logs

No response

System Info

"@radix-ui/react-select": "^2.0.0",

Before submitting

  • [X] I've made research efforts and searched the documentation
  • [X] I've searched for existing issues

asontha avatar Mar 07 '24 16:03 asontha

i dont understand it can you explain a little bit

BinaryZee avatar Mar 07 '24 18:03 BinaryZee

It looks like duplicate of #2010 for me.

brunocroh avatar Mar 08 '24 21:03 brunocroh

Yup it's a duplicate of that one. Same issue.

asontha avatar Mar 12 '24 15:03 asontha

But that ticket is closed so I opened a new one since it hasn't been fixed yet.

asontha avatar Mar 12 '24 15:03 asontha

Sure, as a said in the other issue, I believe the way the radix handle this is right, and is the expected behavior.

I really believe the better way to handle that is on your side, just making the values unique. It not mean that you need to make labels uniques.

Just map duplicated values to unique ones, and after user finish of filling it, map it again to original value that you want.

If it's no clear enough, let me know, so I can create an example of it.

brunocroh avatar Mar 12 '24 15:03 brunocroh