Skip to content

[BUG] Dropdown: Selected options not showing when the value contains a comma  #1908

@AnnMarieW

Description

@AnnMarieW

As reported on the forum by @ marcus:

Problem is in this spot: 'value': "50 , 10"
Specifically comma in value string makes that selection is not being displayed. When coma is removed or replaced (dot creates no issue) it works fine, but when coma is within the string, the selections are not displayed in the input box and are not removed from the options

This only occurs in Multi-Value dropdowns. This is new in Dash V2.1.0 It works as expected in V2.0.0

from dash import Dash, dcc, html, Input, Output

app = Dash(__name__)

app.layout = html.Div(
    [
        dcc.Dropdown(
            id="dropdown",
            className="inputbox-long",
            options=[
                {"label": "New York City", "value": "50, 10"},
                {"label": "Montreal", "value": "MTL" },
                {"label": "San Francisco", "value": "SF"},
            ],
            placeholder="Select one or more",
            multi=True,
        ),
        html.Div(id="output"),
    ]
)


@app.callback(
    Output("output", "children"), Input("dropdown", "value"),
)
def update(value):    
    return value


if __name__ == "__main__":
    app.run_server(debug=True)

dropdown_bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions