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 searched the opened issues and there are no duplicates
Describe the bug
When using an ft.Dropdown component with enable_filter=True, selecting an option using the keyboard (navigating with arrow keys and pressing Enter) visually updates the displayed text in the dropdown, but the value attribute of the dropdown control remains None (or its previous value). Consequently, the on_change event is not triggered for this type of interaction. Selecting an option with a mouse click works as expected, updating the value and triggering on_change.
Code sample
Code
importfletasftdefmain(page: ft.Page):
defon_dd_change(e: ft.ControlEvent):
dd_value=e.control.valueselected_opt_text="N/A"ifdd_value:
# Find the text of the selected optionselected_opt=next((optforoptindd.optionsifopt.key==dd_value), None)
ifselected_opt:
selected_opt_text=selected_opt.texttxt_value.value=f"Dropdown value: {dd_value} (Selected text: {selected_opt_text})"txt_value.update()
print(f"on_change triggered. Dropdown value: {dd_value}") # For console confirmationdd=ft.Dropdown(
label="Test Dropdown",
hint_text="Select an option",
options=[
ft.dropdown.Option(key="ID1", text="Option 1"),
ft.dropdown.Option(key="ID2", text="Option 2"),
ft.dropdown.Option(key="ID3", text="Option 3"),
],
on_change=on_dd_change,
enable_filter=True# Problem observed with this enabled
)
txt_value=ft.Text("No selection yet.")
page.add(dd, txt_value)
ft.app(target=main)
To reproduce
Click on the dropdown to open it (or tab into it and press space/enter).
If the filter input appears, you can type to filter, or just use arrow keys.
Use the arrow keys (up/down) to navigate to an option.
Press the Enter key to select the highlighted option.
Observe the ft.Text below the dropdown and the console output.
Expected behavior
After pressing Enter on a keyboard-selected option:
The dd.value attribute should be updated to the key of the selected ft.dropdown.Option.
The on_dd_change callback function should be triggered.
The ft.Text control (txt_value) should display the updated value and selected text.
A message should be printed to the console indicating on_change was triggered.
Actual behavior After pressing Enter on a keyboard-selected option:
The dropdown visually displays the selected option's text in its input field.
However, the dd.value attribute remains None (or its previous value if one was set by mouse click prior).
The on_dd_change callback function is NOT triggered.
The ft.Text control (txt_value) is NOT updated (or shows the previous state).
No message is printed to the console from the on_change handler for this keyboard interaction.
Screenshots / Videos
2025-05-28.13-36-34.mp4Captures
[Upload media here]
Operating System
Windows
Operating system details
Microsoft Windows 11 Pro version 10.0.22631 Compilação 22631 browse MS EDGE WEB
Duplicate Check
Describe the bug
When using an
ft.Dropdowncomponent withenable_filter=True, selecting an option using the keyboard (navigating with arrow keys and pressing Enter) visually updates the displayed text in the dropdown, but thevalueattribute of the dropdown control remainsNone(or its previous value). Consequently, theon_changeevent is not triggered for this type of interaction. Selecting an option with a mouse click works as expected, updating thevalueand triggeringon_change.Code sample
Code
To reproduce
Expected behavior
After pressing Enter on a keyboard-selected option:
The dd.value attribute should be updated to the key of the selected ft.dropdown.Option.
The on_dd_change callback function should be triggered.
The ft.Text control (txt_value) should display the updated value and selected text.
A message should be printed to the console indicating on_change was triggered.
Actual behavior After pressing Enter on a keyboard-selected option:
The dropdown visually displays the selected option's text in its input field.
However, the dd.value attribute remains None (or its previous value if one was set by mouse click prior).
The on_dd_change callback function is NOT triggered.
The ft.Text control (txt_value) is NOT updated (or shows the previous state).
No message is printed to the console from the on_change handler for this keyboard interaction.
Screenshots / Videos
2025-05-28.13-36-34.mp4
Captures
[Upload media here]
Operating System
Windows
Operating system details
Microsoft Windows 11 Pro version 10.0.22631 Compilação 22631 browse MS EDGE WEB
Flet version
0.27.6
Regression
No, it isn't
Suggestions
No response
Logs
Logs
[Paste your logs here]Additional details
No response