-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gr.Dropdown
now has correct behavior in static mode as well as when an option is selected
#5062
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-5062-all-demos You can install the changes in this PR by running: pip install https://gradio-builds.s3.amazonaws.com/8745dac99c5523561c7cd3296805500538c611c0/gradio-3.39.0-py3-none-any.whl |
🎉 Chromatic build completed! There are 0 visual changes to review. |
} else { | ||
filterInput.blur(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm missing something, these lines can never be reached @dawoodkhan82?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your cleanup of this makes sense. But I think these lines should've been hit. How else was the input being blurred? But I also didn't go back and test on main, so not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I also tested kitchen-sink
and the dropdown works fine. One nit for the static
dropdown would be to change the cursor from pointer to default when hovering over the token.
} else { | ||
filterInput.blur(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your cleanup of this makes sense. But I think these lines should've been hit. How else was the input being blurred? But I also didn't go back and test on main, so not sure.
Thanks for the review @dawoodkhan82!
I'll fix that!
What do you mean? Why should the input be blurred in the focus method? Maybe I'm missing something This was never hit because |
Ah yes I see what you mean. Yes we're good to remove it then! |
Sounds good, thanks for the confirmation.
I was rethinking this, and I think its better to leave as is because clicking while disabled still triggers the |
2 more fixes to
gr.Dropdown()
:gr.Dropdown(multiselect=True)
still had the X icons, and clicking on an option would remove it. This behavior has been disabled in static mode. Test with:Also we had never really documented how Gradio determines the interactivity of a component if
interactive
was not specified and the component was neither an input nor an output. I've added that to the relevant Guide. Together, this closes: #4280.gr.Dropdown(multiselect=False)
would select it, yet it would keep the focus on the Dropdown and in particular would keep the cursor typing. This led to an interesting bug described in Dropdown pops up if focus is lost during change. #4269. I've changed the behavior so that clicking on a choice actually unfocuses from the dropdown. This is a more satisfying UX, more similar to the native select element's UX, and closes: Dropdown pops up if focus is lost during change. #4269.Also added a few
gr.Dropdown
stories to prevent regression of the former issue.