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

clearOptions() deselects currently-selected items, but does not remove them as options #2146

Open
5 tasks done
dvg-p4 opened this issue Oct 9, 2024 · 0 comments · May be fixed by #2147
Open
5 tasks done

clearOptions() deselects currently-selected items, but does not remove them as options #2146

dvg-p4 opened this issue Oct 9, 2024 · 0 comments · May be fixed by #2147

Comments

@dvg-p4
Copy link

dvg-p4 commented Oct 9, 2024

I did:

  • Search for if my issue has already been submitted
  • Make sure I'm reporting something precise that needs to be fixed
  • Give my issue a descriptive and concise title
  • Create a minimal working example on JsFiddle or Codepen
    (or gave a link to a demo on the Selectize docs)
  • Indicate precise steps to reproduce in numbers and the result,
    like below

[replace me with a short description of issue]

Steps to reproduce:

  1. Go to https://selectize.dev/docs/demos/api
  2. Make a selection, e.g. "Star Chart"
  3. Click the clearOptions() button

Expected result:

EITHER:

  • The behavior described by the current API docs:
    • The current selection is cleared
    • All options are removed
  • (This was the behavior of selectize.js < v0.12.5)

OR:

Actual result:

  • Only non-selected items are removed from the options
  • Any current selections are cleared, but remain as options

Cause:

#1553 (released in v0.13.1) added back the self.clear() to the end of the clearOptions code, but did not remove the logic change that prevents currently-selected items from being removed from the list of options. This PR was intended to close #832 , but that request only made sense before the behavior of clearOptions() was changed (in v0.12.5) to not affect the current selection. I suspect that this oversight was due to v0.12.5 not updating the docs to clarify that selected items were intended to be kept--the newer PR also updated the docs to imply that the pre-0.12.5 behavior was intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant