-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Components: introduce Combobox expandOnFocus
property
#61705
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Interesting! The APG doesn't suggest a standard expansion logic, and the possible conditions it suggests include some quite particular custom logic. So my understanding is that, ideally, a consumer should be able to control the expansion behavior with much more precision, rather than just blunt conditions like "is focused" or "was clicked". This should be easy to support once we rewrite a v2 with Ariakit.
That said, the enhancement in this PR is small enough, so I don't see why not 👍
Co-authored-by: Lena Morita <lena@jaguchi.com>
Co-authored-by: Lena Morita <lena@jaguchi.com>
4ff4ca4
to
23fd776
Compare
What?
This property introduces the
expandOnFocus
property to the Combobox control component.Why?
Sometimes, auto-expanding the combo box dropdown is not a desired behavior and could even be considered intrusive.
For instance, AriaKit combobox never auto-expands the dropdown in the focus event.
Screen.Recording.2024-05-16.at.09.25.26.mov
The dropdown opens only when the user types in the input field or clicks on it.
Note: it doesn't change the current behavior to ensure backward compatibilities, which we would consider it.
How?
onClick
property to the<TokenInput />
component, since it's mandatory to differetiate theonFocus
and theonClick
event in the<ComboboxControl />
component contextisExpanded
as true only when theexpandOnFocus
property is true as well.Testing Instructions
Not Expand On Focus
does not auto-expand the dropdown when the user focuses on the input element. It's required to type or click on it to open the dropdown:Screen.Recording.2024-05-16.at.09.21.47.mov
Testing Instructions for Keyboard
Screenshots or screencast