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

createFilter blocks selection of valid option #275

Closed
brennerm opened this issue Jan 11, 2025 · 1 comment
Closed

createFilter blocks selection of valid option #275

brennerm opened this issue Jan 11, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@brennerm
Copy link

Hey @mskocik,

first things first, thanks for this library! 🙏 It has been very useful for multiple of my side projects.

While recently using the create feature for the first time I have been encountering a behavior which doesn't seem right. Here's how to reproduce it:

  1. Set creatable to true and add createFilter={() => true} (always deny creating)
  2. Provide a few valid options to Svelecte
  3. Start searching for a valid option, select it using the arrow key and press Enter

My expectation would be that selecting any provided option would always work but the createFilter function seems to block it.
Here's a REPL that contains an example to reproduce the issue.

I've already had a look at the code and identified that the issue is probably in this block of code as it doesn't check which option is currently selected and just prevents the selection if the createFilter returns true.

Just wanted to double check with you whether I'm missing something here. Let me know what you think. 🙂

@mskocik
Copy link
Owner

mskocik commented Jan 12, 2025

Yes, you're right. It's a bug, but it's not the only one I found when fixing. Therefore it will take more time. Hopefully tomorrow will have more time for it 🤞

@mskocik mskocik added the bug Something isn't working label Jan 12, 2025
@mskocik mskocik self-assigned this Jan 12, 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

2 participants