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

Set selected toggles rather than adds on dropdown that has useLabels: false setting #670

Closed
guushoekman opened this issue Apr 15, 2019 · 4 comments
Labels
lang/javascript Anything involving JavaScript type/bug Any issue which is a bug or PR which fixes a bug
Milestone

Comments

@guushoekman
Copy link

Bug Report

Set selected toggles rather than adds values on multiple value dropdown that has useLabels: false setting.

Steps to reproduce

  1. Create a dropdown
  <div class="ui multiple selection dropdown">
    <input type="hidden" name="example">
    <i class="dropdown icon"></i>
    <div class="default text">Example</div>
    <div class="menu">
      <div class="item" data-value="foo">Foo</div>
      <div class="item" data-value="bar">Bar</div>
    </div>
  </div>
  1. Initialise it with $(".ui.dropdown").dropdown({useLabels: false});

  2. Use set selected on the same values multiple times: $(".dropdown").dropdown("set selected", ["foo", "bar"])

Expected result

The values will be added and remain regardless of how many times $(".dropdown").dropdown("set selected", ["foo", "bar"]) is run.

Actual result

The values toggle. If you remove useLabels: false it works as expected.

Testcase

https://jsfiddle.net/a5j7u231/

Version

2.7.4

@lubber-de lubber-de added type/bug Any issue which is a bug or PR which fixes a bug lang/javascript Anything involving JavaScript labels Apr 16, 2019
@lubber-de lubber-de added this to the 2.7.7 milestone Jul 24, 2019
@lubber-de
Copy link
Member

lubber-de commented Jul 24, 2019

Fixed by #899
See your adjusted jsfiddle here https://jsfiddle.net/k8oqpjgx/1/

@guushoekman
Copy link
Author

That's great! Thank you for working on this.

One thing though: it's no longer possible to deselect an option. Removing {useLabels: false} makes deselecting work again, so (to my layman eyes) it seems to be caused by your changes.

@lubber-de
Copy link
Member

@guushoekman 😱 I'll work that out

@lubber-de
Copy link
Member

@guushoekman Fixed that also, thanks for the quick response!
See new testcase here https://jsfiddle.net/k8oqpjgx/1/

@lubber-de lubber-de added the tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build label Jul 25, 2019
@y0hami y0hami closed this as completed in 53c22c9 Jul 28, 2019
@lubber-de lubber-de removed the tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build label Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/javascript Anything involving JavaScript type/bug Any issue which is a bug or PR which fixes a bug
Projects
None yet
Development

No branches or pull requests

2 participants