Semantic-ui-react: fix(Dropdown): placeholder value changes on opening the dropdown without selecting a value

Created on 11 Apr 2018  路  5Comments  路  Source: Semantic-Org/Semantic-UI-React

Steps to Reproduce

  1. open the dropdown

Expected
Place holder value should remain intact until a value is selected

Result
Placeholder value changes to first option.

Testcase
screen shot 2018-04-11 at 5 25 20 pm

triage

Most helpful comment

This behavior is indeed weird, please reopen

All 5 comments

馃憢 Thanks for opening your first issue here! If you're reporting a 馃悶 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

I don't know if that case is a issue. Only happen when you have selection and it is not multiple or search. I solved that case to keep placeholder in this way.

<Dropdown selectOnBlur={false} onChange={this.handleChange} placeholder="Select State ..." selection options={options} text={value || "Select State ..."} />

it is only a example, you can manage in other way. You can check it from here. See codepen

This is, in fact, the intended behavior of the Dropdown. See the original Dropdown here:

https://semantic-ui.com/modules/dropdown#search-selection

The placeholder is used to show a preview of the selected item's value or text attribute.

@levithomason This is not happening on the link you shared, and the behavior is different if we check on React Semantic Dropdown and Semantic UI Dropdown.

On react the placeholder changes, on the other one not.

Also on react, if you open the dropdown and close it by clicking outside, without selecting any option, the first option will be automatically selected, which is pretty weird, given that if you open and click on the Dropdown itself (on the input field), then a value is not selected.

This behavior is indeed weird, please reopen

Was this page helpful?
0 / 5 - 0 ratings

Related issues

devsli picture devsli  路  3Comments

nix1 picture nix1  路  3Comments

jayphelps picture jayphelps  路  3Comments

laukaichung picture laukaichung  路  3Comments

AlvMF1 picture AlvMF1  路  3Comments