Closed apolinario closed 8 months ago
Very cool @apolinario! We could definitely add a new event .type()
that gets triggered at every keystroke. I think a .change()
event is not suitable here because that is only triggered when the value of a component changes, which is not the case if a user just types a letter into the Dropdown
component
I see! Maybe when allow_custom_value=True
then the value of the component may be considered changing in real time? (Similar to how the gr.Textbox()
triggers per keystroke and not only when unfocused).
But I agree a .type()
event would be great!
Describe the bug
Currently,
.change
or.input
events are only triggered ingr.Dropdown
if an option is selected and not while being typed (whenfilterable=True
allows typing) as it is for thegr.Textbox()
.As the
.select
event already fulfils the purpose of only triggering an event if a valid option is selected - I think.change
/.input
become a bit redundant for such use-case. This is the reason why this is filled as a bug and not a feature request (imo as the.select
event already behaves for option selection, it is a bug that.change
/.input
isn't triggered while the user is typing withfilterable=True
).Addressing this bug would allow for cool new use-cases such as changing the options in the dropdown component in real time based on what the user is typing (e.g.: quick search). Internal thread with more context
Have you searched existing issues? 🔎
Reproduction
Colab: https://colab.research.google.com/drive/1NynI5ZtQs3F8RAoCq3GhUYMU19ji3iEB?usp=sharing Space: https://huggingface.co/spaces/multimodalart/gradio-dropdown-autocomplete
Video
https://github.com/gradio-app/gradio/assets/788417/c5d6985b-1433-40e0-b983-be4ef8b5f2f7
Logs
No response
System Info
Severity
I can work around it