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

Fully disable animation style if enableAnimations is false. #16893

Merged
merged 2 commits into from
Aug 5, 2019

Conversation

miina
Copy link
Contributor

@miina miina commented Aug 2, 2019

Description

useMovingAnimation accepts enableAnimation as param, however, the animation styling is applied eventually to the block wrapper even if enableAnimation is set to false. With enableAnimation set to false, transform is set to undefined, also transformOrigin is always set.

This can potentially override existing transform coming from wrapperProps.style via a filter for example.

How has this been tested?

Functional testing making sure that the block animations remain as they are by default.
Also tested that when setting enableAnimations to false the animation related styles are not applied.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

let animationStyle = useMovingAnimation( wrapper, isSelected || isPartOfMultiSelection, enableAnimation, animateOnChange );

// Dismiss animation style if animations are disabled.
animationStyle = enableAnimation ? animationStyle : {};
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we do that in the hook itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved within 029c0a8.

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thanks for the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants