Skip to content
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

DropdownMenuV2: update animation #64868

Merged
merged 12 commits into from
Sep 2, 2024
Merged

Conversation

ciampo
Copy link
Contributor

@ciampo ciampo commented Aug 28, 2024

What?

Part of #50459

Updates DropdownMenuV2 animation following the latest specs (shared by @nick-a8c)

Why?

For a better sense of polish, and alignment with the rest of the animations in Gutenberg.

How?

The new animation specs require the popover wrapper and the popover contents to scale at different rates. That required a small refactor to include an extra wrapper element, to account for the two separate animations (proof of concept: https://codepen.io/ciampo/pen/mdZjPWg)

The scale animation does not happen when the popover opens to the side of its trigger — in that case, the popover only fades in.

Testing Instructions

Check DropdownMenuV2 examples in Storybook and its usages across the editor, make sure the animation looks good and follows the specs, without impactive the usability and the semantics of the component.-->

Screenshots or screencast

ddmv2.new.anim.spec.mp4

@ciampo ciampo requested a review from ajitbohra as a code owner August 28, 2024 12:21
@ciampo ciampo requested review from a team August 28, 2024 12:21
@ciampo ciampo self-assigned this Aug 28, 2024
Copy link

github-actions bot commented Aug 28, 2024

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 props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @nick-a8c.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: nick-a8c.

Co-authored-by: ciampo <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: mtias <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ciampo ciampo added [Type] Enhancement A suggestion for improvement. [Package] Components /packages/components labels Aug 28, 2024
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible we broke the use case in a modal?

Here's what I'm seeing with this PR:

Screen.Recording.2024-08-28.at.20.41.38.mov

and with trunk, things work well:

Screen.Recording.2024-08-28.at.20.43.56.mov

@ciampo ciampo force-pushed the feat/dropdown-menu-v2-animation-specs branch from 10d7ae9 to 788066b Compare August 28, 2024 18:40
@ciampo
Copy link
Contributor Author

ciampo commented Aug 28, 2024

Nice find — the latest commit should fix it

Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM and tests well for me 👍 🚀

Left a few minor optional suggestions.

Do we need a design 👁️ on it before merging?

packages/components/src/dropdown-menu-v2/styles.ts Outdated Show resolved Hide resolved
packages/components/src/dropdown-menu-v2/styles.ts Outdated Show resolved Hide resolved
@jameskoster
Copy link
Contributor

Very nice! :)

I'm seeing some small visual artefacts as I cursor around the menu, almost like the background color applied to the hover state is ever-so slightly bleeding through around the edge of the resting state. Here's a video:

artefacts.mp4

And a screenshot (see the Duplicate item):

Screenshot 2024-08-29 at 15 19 31

Separately; I prefer this animation effect overall but it doesn't seem quite as snappy as the current, I wonder if we should speed it up slightly, perhaps 200ms rather than 400?

@ciampo ciampo force-pushed the feat/dropdown-menu-v2-animation-specs branch from 788066b to 04c9924 Compare August 30, 2024 08:56
@ciampo
Copy link
Contributor Author

ciampo commented Aug 30, 2024

I addressed all of @tyxla 's feedback.

@jameskoster :

I'm seeing some small visual artefacts as I cursor around the menu, almost like the background color applied to the hover state is ever-so slightly bleeding through around the edge of the resting state.

I can also reproduce on my machine in the site editor, but I can't reproduce in Storybook — it feels like a browser glitch, and I'm unsure how much we can do about it. I'm not sure if this is somehow related to ariakit/ariakit#4083.

I prefer this animation effect overall but it doesn't seem quite as snappy as the current, I wonder if we should speed it up slightly, perhaps 200ms rather than 400?

Talking with @nick-a8c, we put the specs and the real animation side-to-side, and the only difference we could notice was in the outer wrapper scale factor — which I now updated to hopefully match spec even better.

Regarding the animation duration, I guess the tricky part is to find a length that feels good for both small and large menus. The larger the menu, the more distance it needs to travel. Therefore, this same animation will potentially feel snappier for larger menus, and slower for smaller menus. If we pick a duration that is too short, the animation may feel too fast for large menus. If we pick a duration that is too long, the animation may feel too slow for smaller menus. IMO it's a matter of choosing the right compromise, and I think you and @nick-a8c are the best people to pick a value.

You can test different animation settings by tweaking these values — let me know once you settle on a duration, and I can update the PR and merge it.

@nick-a8c
Copy link

Thank you, @ciampo, for applying the edits! Regarding the balance for animation duration between small and large menus, I was thinking we could run a test using the exact same elements. This way, we can ensure the motion matches perfectly both in After Effects and CSS.

We could use the same menu content and length for the test, creating two versions—one with a longer menu and one with a shorter menu. This would help us see how the animation behaves with different content lengths and allow us to find that ideal duration for both cases.

@jameskoster, do you have two menus in mind—one short and one long—so I can apply the AE motion to them? Then Marco can use the same menus to match and compare the movement later.

@ciampo
Copy link
Contributor Author

ciampo commented Aug 30, 2024

do you have two menus in mind—one short and one long—so I can apply the AE motion to them? Then Marco can use the same menus to match and compare the movement later.

You could likely use the Storybook examples — there are menus of different lengths.

@jameskoster
Copy link
Contributor

I'm happy to defer to Nick on the duration :)

@ciampo ciampo force-pushed the feat/dropdown-menu-v2-animation-specs branch from 04c9924 to bd6d70b Compare August 30, 2024 17:09
@ciampo
Copy link
Contributor Author

ciampo commented Aug 30, 2024

Pushed a little update that hopefully will help with the glitchiness flagged by Jay above.

I'm happy to defer to Nick on the duration :)

Sounds good to me — @nick-a8c, feel free to suggest a different duration, otherwise I guess we can merge the PR as-is

Copy link

github-actions bot commented Aug 30, 2024

Flaky tests detected in 76d217e.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10664369751
📝 Reported issues:

@mtias
Copy link
Member

mtias commented Aug 31, 2024

This is looking good! Do we have exit animations planned for them?

@ciampo
Copy link
Contributor Author

ciampo commented Sep 2, 2024

I'm not aware of any exit animation specs, but I'm happy to discuss them with Jay and Nick.

@nick-a8c
Copy link

nick-a8c commented Sep 2, 2024

This is looking good! Do we have exit animations planned for them?

@mtias I’m currently suggesting a fade-out (100ms), as shown in the video example. I’m not sure if an exit animation is necessary, but I’ll gather more information and present a few solutions in the next 'Site Editor Motion' update.

I’m also interested in hearing @jameskoster's thoughts on this.

feedback-01.mp4

@ciampo ciampo force-pushed the feat/dropdown-menu-v2-animation-specs branch from bd6d70b to 75b70aa Compare September 2, 2024 08:18
@ciampo
Copy link
Contributor Author

ciampo commented Sep 2, 2024

Added fade-out exit animation, in case you wanted to test in in Storybook / the editor

ddmv2.mp4

Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exit animation works great in my testing 👍

packages/components/src/dropdown-menu-v2/styles.ts Outdated Show resolved Hide resolved
@ciampo ciampo force-pushed the feat/dropdown-menu-v2-animation-specs branch from fad29d8 to c26c72e Compare September 2, 2024 11:56
@ciampo ciampo enabled auto-merge (squash) September 2, 2024 12:01
@ciampo
Copy link
Contributor Author

ciampo commented Sep 2, 2024

I'm going to merge this PR with the current specs — we can always iterate with tweaks as needed.

@ciampo ciampo merged commit c0c870c into trunk Sep 2, 2024
61 checks passed
@ciampo ciampo deleted the feat/dropdown-menu-v2-animation-specs branch September 2, 2024 12:31
@github-actions github-actions bot added this to the Gutenberg 19.2 milestone Sep 2, 2024
@mtias
Copy link
Member

mtias commented Sep 2, 2024

Awesome! The exit animation helps quite a bit, let's see how it goes.

@jeffpaul
Copy link
Member

jeffpaul commented Nov 8, 2024

@nick-a8c would you mind sharing your WordPress.org username so we can ensure you're properly credited in the 6.7 release next week?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants