Skip to content

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

@dvg-p4

Description

@dvg-p4

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions