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

Combobox: Searching with numbers in multiple mode auto-selects options #2128

Closed
mimarz opened this issue Jun 17, 2024 · 1 comment
Closed
Assignees
Labels
🐛 bug Something isn't working react @digdir/designsystemet-react

Comments

@mimarz
Copy link
Collaborator

mimarz commented Jun 17, 2024

Found when testing for bug #2124.

Whenever i type only numbers, it automatically selects options.

Changing the value to be prefixed with something number seems to solve the issue. Maybe we missed something with #2095 where we applied this logic internally.

Forked sandbox with updated next version which was published today: https://codesandbox.io/p/sandbox/broken-night-forked-nrh89r?file=%2Fsrc%2FApp.tsx%3A40%2C25

@mimarz mimarz converted this from a draft issue Jun 17, 2024
@mimarz mimarz added 🐛 bug Something isn't working react @digdir/designsystemet-react labels Jun 17, 2024
@Barsnes
Copy link
Member

Barsnes commented Jun 17, 2024

This is expected to happen, since we are checking if the input matches a value:

// ComboboxInput.tsx:72

// check if input value is the same as a label, if so, select it
    const option = options[prefix(value.toLowerCase())];
    if (!option) return;
    if (selectedOptions[prefix(option.value)]) return;

This is wrong, and I will fix this - it should check on the display value instead

@Barsnes Barsnes moved this from 🔵 Inbox to 🏗 In progress in Team Designsystemet Jun 17, 2024
@Barsnes Barsnes self-assigned this Jun 17, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Team Designsystemet Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working react @digdir/designsystemet-react
Projects
Archived in project
Development

No branches or pull requests

2 participants