Skip to content

createFilter blocks selection of valid option #275

@brennerm

Description

@brennerm

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. 🙂

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions