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

fix(Dropdown): input doesn't get cleared when adding item #2048

Closed
skulptur opened this issue Sep 4, 2017 · 4 comments
Closed

fix(Dropdown): input doesn't get cleared when adding item #2048

skulptur opened this issue Sep 4, 2017 · 4 comments

Comments

@skulptur
Copy link

skulptur commented Sep 4, 2017

Steps to Reproduce

  1. Using the example specified on the Testcase bellow, type 'hi' and hit enter
  2. Hit delete to remove the added selection
  3. Type 'hi' again and hit enter
  4. Repeat steps 1 to 3 and use the word 'hello'

Result
The second time the user hits enter, the word 'hi' remains in the input and the dropdown still suggests the addition of 'hi' to the options. When adding 'hello', the input is cleared, but the dropdown still suggests a new addition of 'hello'.

Expected
It is expected that the dropdown clears the input after an addition and recognizes that the option has been added instead of suggesting a new addition.

Testcase
If the docs show the issue, use: https://react.semantic-ui.com/modules/dropdown#dropdown-example-multiple-allow-additions
Otherwise, fork this to get started: http://codepen.io/levithomason/pen/ZpBaJX

@layershifter
Copy link
Member

Duplicate #1954. This behaviour was introduced in #1795, there was also PR for this #1955, but it wasn't finished. I like idea suggested there.

@skulptur
Copy link
Author

skulptur commented Sep 4, 2017

I didn't find mention on the problem where the dropdown suggests the addition of an item that has already been added. I'm talking about the allowAdditions flag, as opposed to when selecting a new item.

@dardub
Copy link

dardub commented Sep 14, 2017

The new behavior introduced in #1795 also introduced a bug when the allowAdditions is used. Can this issue be re-opened?

This bug makes it too easy to create duplicate entries by the user.

@layershifter
Copy link
Member

You can control your options with onAddItem handlers and skip duplicates. After we will make searchQuery contollable you will can to clear its value after onChange. I also think that we should transform the additionalLabel prop to shorthand, this will allow to pass null when option has already added.

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

No branches or pull requests

3 participants