Skip to content

Conversation

@lhkraus
Copy link

@lhkraus lhkraus commented Mar 21, 2021

Hello guys, it would be nice to have an option that removes only one selected option, when my selector has multiple options selected, so this is my proposal.

It is my first time contributing so I hope that this is helpful.

@romgain
Copy link
Owner

romgain commented Mar 23, 2021

Hi @lhkraus , and thanks for the contribution!

I understand the use case, but we should aim to keep the API consistent.
Here are my thoughts / suggestions:

  • Rename clearOne to clear (there already is a private clear function in the project, so we'll need to rename that one as well to avoid clashes)
  • Refactor the clear function so that it accepts an optionOrOptions, like the select function
  • Refactor the clear function so that if no options are supplied, it clears the first element. Mark clearFist as deprecated and document that users should migrate to using clear without options instead.
  • When multiple options are found, I think we should clear all of them , not just the first one
  • We should throw a useful error message if one option supplied by the user cannot be found.

Let me know what you think and if you'd be interested in implementing these changes.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants