You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Dropdown component that I use as a search field. The available options in the menu are looked up on the backend as the user types in the field. The approach is very much similar to that in the documentation.
Since version 2.4.0, dcc.Dropdown started clearing the value typed for searching on repeated searches. The bug is likely a regression due to #1970 addressing #1868.
As the user starts typing, the typed value gets cleared midway, re-triggering the search again and returning unexpected results for a partial search typed.
Screen capture showing the problem
Dash version 2.4.0
dash-2.4.0.mp4
Screen capture showing the expected behavior
Dash version 2.3.1
dash-2.3.1.mp4
Sample code
from dash import Dash, dcc, html, dcc, Input, Output
from dash.exceptions import PreventUpdate
options = [
{"label": "aa1", "value": "aa1"},
{"label": "aa2", "value": "aa2"},
{"label": "aa3", "value": "aa3"},
{"label": "best value", "value": "bb1"},
{"label": "better value", "value": "bb2"},
{"label": "bye", "value": "bb3"},
]
app = Dash(__name__)
app.layout = html.Div([
html.Div([
"Single dynamic Dropdown",
dcc.Dropdown(id="my-dynamic-dropdown")
], style={'width': 200, 'marginLeft': 20, 'marginTop': 20}),
])
@app.callback(
Output("my-dynamic-dropdown", "options"),
Input("my-dynamic-dropdown", "search_value")
)
def update_options(search_value):
if not search_value:
raise PreventUpdate
return [o for o in options if search_value in o["label"]]
if __name__ == "__main__":
app.run_server(debug=True, port=5000)
More examples
The same behaviour is now observed on the docs page as I type Montreal and the M gets cleared.
docs.mp4
The text was updated successfully, but these errors were encountered:
Environment
Describe the bug
I have a Dropdown component that I use as a search field. The available options in the menu are looked up on the backend as the user types in the field. The approach is very much similar to that in the documentation.
Since version 2.4.0,
dcc.Dropdown
started clearing the value typed for searching on repeated searches. The bug is likely a regression due to #1970 addressing #1868.As the user starts typing, the typed value gets cleared midway, re-triggering the search again and returning unexpected results for a partial search typed.
Screen capture showing the problem
Dash version 2.4.0
dash-2.4.0.mp4
Screen capture showing the expected behavior
Dash version 2.3.1
dash-2.3.1.mp4
Sample code
More examples
The same behaviour is now observed on the docs page as I type
Montreal
and theM
gets cleared.docs.mp4
The text was updated successfully, but these errors were encountered: