-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ToggleGroupControl
: clean up animation logic
#65808
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
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.
Thank you for working on this!
Changes are testing well in Storybook and the editor.
Left a couple of comments about the API design of the hook, but all pretty small stuff. Snapshots need updating too.
Next steps are to move useAnimatedOffsetRect
to the shared utils folder and re-use it in Tabs too, right?
Side note: it would be a nice touch to add an animation to the indicator when it's shown/hidden, even a simple fade. I believe that's also how it worked with the previous implementation. Could we do that in a follow-up?
packages/components/src/toggle-group-control/toggle-group-control/component.tsx
Show resolved
Hide resolved
packages/components/src/toggle-group-control/toggle-group-control/component.tsx
Outdated
Show resolved
Hide resolved
packages/components/src/toggle-group-control/toggle-group-control/component.tsx
Outdated
Show resolved
Hide resolved
Yes, follow up is to move to utils and use in Tabs. About the fade, I'm not sure I like it or see it necessary. Maybe worth proposing in an issue and looping design folks in. I personally like things to be snappy and a fade goes against that. |
👌
Separate issue + design folks ping SGTM 👍 |
Addressed your feedback @ciampo. Thanks! Edit: also updated snapshots. |
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.
LGTM 🚀
What?
Misc. cleanups and improvements of the
useSubelementAnimation
(now renamed touseAnimatedOffsetRect
).Why?
To improve clarity and also to later hoist and reuse the same utility in
Tabs.Tablist
.How?
Functionally, the implementation is unchanged. However, I made the following improvements:
TabList
, where the rect is used for other purposes.Testing Instructions
Check that the ToggleGroupControl animation still works as expected, both in Storybook and in Gutenberg instances.
Demo
chrome_a72hnAGpiY.mp4