Skip to content

[Dropdown] Multiple dropdown doesn't show selected label if the selected value has ampersand "&" #2782

@gfkateo

Description

@gfkateo

Bug Report

When creating a multiple dropdown using <select> element and the selected option's value contains ampersand, the label for the selected value doesn't show.

Expected result

Should show the label of the selected option

Screenshot from 2023-05-09 16-33-50

Actual result

Screenshot from 2023-05-09 16-21-34

Ran this code in the console

$('.ui.dropdown.sample1').dropdown('get value')

and it returns the correct value

["b & c"]

Also, I've tested creating a dropdown with using <div class="ui multiple selection dropdown"> element, and it doesn't have this issue. (See Sample 3 field in the Codepen testcase)

Testcase

Codepen URL

HTML

<div class="field">
  <label>Sample 1: Using select element with ampersand</label>
  <select name="values1" class="ui fluid dropdown sample1" multiple>
    <option value="">Select at least one</option>
    <option value="a">A</option>
    <option value="b & c" selected>B & C</option>
    <option value="d">D</option>
  </select>
</div>

Javascript

$('.ui.dropdown').dropdown();

Version

2.9.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugAny issue which is a bug or PR which fixes a bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions