selectize.js
selectize.js copied to clipboard
clearOptions() deselects currently-selected items, but does not remove them as options
I did:
- [x] Search for if my issue has already been submitted
- [x] Make sure I'm reporting something precise that needs to be fixed
- [x] Give my issue a descriptive and concise title
- [x] Create a minimal working example on JsFiddle or Codepen (or gave a link to a demo on the Selectize docs)
- [x] Indicate precise steps to reproduce in numbers and the result, like below
[replace me with a short description of issue]
Steps to reproduce:
- Go to https://selectize.dev/docs/demos/api
- Make a selection, e.g. "Star Chart"
- 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:
- The behavior described by the changelog:
- Any non-selected options are removed
- The current selection remains selected
- This was requested by #593 and #1079 and implemented by https://github.com/selectize/selectize.js/commit/f6c4f7c51b0858e4b0f8023fed90d360e3a0d900; it was the behavior of selectize.js ≥ v0.12.5, < v0.13.1
Actual result:
- Only non-selected items are removed from the options
- Any current selections are cleared, but remain as options
Cause:
https://github.com/selectize/selectize.js/pull/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.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days
This issue is still present and the corresponding PR is still fully ready for review.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days
Once again, this issue is still present and the corresponding PR is still fully ready for review. If this repo is at all being maintained, I'd personally recommend either working through the backlog of issues and PRs more frequently than your bot marks issues as stale, or turning off that functionality of your bot if you can't commit to that schedule (totally understandable, this is FOSS).
I'm putting up a different recommendation. #2205
Maybe it's time to find a project that's more active and build out migration tools to make the transition smoother. Selectize has been trying to find maintainers for years now and I've actively asked for the ability to build + release but I can't seem to get that either.
Plus the jQuery dependency is longe overdue to get yanked since vanilla JS is capable. I say we move towards another active project and just make it easy to move.
There is https://github.com/orchidjs/tom-select.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days