Semantic-Org / Semantic-UI

Semantic is a UI component framework based around useful principles from natural language.
http://www.semantic-ui.com
MIT License
51.1k stars 4.95k forks source link

[Dropdown] Should select option with selected attribute for select element with options having numeric values and labels #7111

Open maniz-stha opened 1 year ago

maniz-stha commented 1 year ago

Steps

Create a select element with options that have numeric values and labels. `

Initialize dropdown with $('.dropdown').dropdown();`

Expected Result

The second option with value "4" should be selected.

Actual Result

The last optioin with label "4" is selected when rendered.

Version

2.4.1

Testcase

https://jsfiddle.net/wz3d0nre/1/

GammaGames commented 1 year ago

This appears to be fixed in Fomantic-UI

https://jsfiddle.net/y2bnm9qw/

leodaouk commented 1 year ago

Hello,

Issue is still happening on Semantic-UI, and is easier to view if you add "multiple" class to select. The result is the select has both 4 value and 4 labelled selected instead of only one. (https://github.com/Semantic-Org/Semantic-UI-CSS/blob/4049ee43af2613c62252f42b13addd737adf6420/components/dropdown.js#L1954)

Fomantic-UI changed bahavior by having only value search instead of value or text search (https://github.com/fomantic/Fomantic-UI/blob/0c3158da48b025adfc3f5424373d3254af014b1e/dist/components/dropdown.js#L2156)