-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
CustomSelectControlV2: Fix hint behavior in legacy #60183
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. |
Size Change: 0 B Total Size: 1.72 MB ℹ️ View Unchanged
|
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 and tests well! 👍
Now the __experimentalShowSelectedHint
prop also makes complete sense.
Thank you 🚀
da622b8
to
414011d
Compare
* Add tests (failing) * CustomSelectControlV2: Fix hint behavior in legacy * Add changelog Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
* Add tests (failing) * CustomSelectControlV2: Fix hint behavior in legacy * Add changelog Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
Part of #55023
Stacked on #60182
What?
Fixes an incorrect back compat implementation in CustomSelectControlV2 Legacy where "hints" in the dropdown should always be shown if available, regardless of the
__experimentalShowSelectedHint
prop.Why?
The CustomSelectControlV2 Legacy implementation needs to match the v1 behavior as close as possible.
How?
By adding a new unit test to v1, I established that hints in the dropdown options are always shown if provided, regardless of whether the
__experimentalShowSelectedHint
prop is enabled. (As the prop name accurately describes, the boolean is supposed to only control the visibility of the hint in the selected option — the one shown in the dropdown trigger.)I then fixed the unit test in v2 Legacy to reflect this correct spec.
Finally, I fixed the v2 Legacy implementation so the failing test passes.
Testing Instructions
This behavior can also be confirmed in the Storybook stories for CustomSelectControl V2 Legacy "With Hints" and CustomSelectControl "With Hints", by toggling the
__experimentalShowSelectedHint
prop control.