Skip to content

[Bug]: option displayed is the default one when default option have the same value as the one selected #841

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

Open
daymoz opened this issue Dec 17, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@daymoz
Copy link

daymoz commented Dec 17, 2024

Bug description

When a default option has the same value has another option that is selected, the default one is displayed instead of the one selected.

This can be encountered when using select as facets and the option values are URL to sort a list. When an option is selected, the page is reload, and the selected option has the same value as the default option so when we click on it removes the facet.

Expected behavior

Even if there are some workarounds for this situation, selected option should take the priority over other options that have the same value and that are not selected.

Steps to reproduce

I have a codesandbox with 4 examples. The n°3 one is my issue.
https://codesandbox.io/p/sandbox/z5x2vf

Additional context

  • Browser [Every browser]
@daymoz daymoz added the bug Something isn't working label Dec 17, 2024
@TheCrossLegCoder
Copy link

I’m experiencing the same issue. The selected option should either be highlighted by default or moved to the top.
When selectOnTab is set to true, this ensures that when the user presses tab, the selected option remains unchanged.

@KES777
Copy link

KES777 commented Jan 8, 2025

I faced the similar problem when few options have the same ID. #854
Though my issue looks similar it is a different.

Copy link

github-actions bot commented May 9, 2025

This issue has not been active in 120 days and has been marked "stale". Remove stale label or comment or this will be closed in 15 days

@github-actions github-actions bot added the stale No activity label May 9, 2025
@KES777
Copy link

KES777 commented May 10, 2025

Not stale

@github-actions github-actions bot removed the stale No activity label May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants