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

ToggleGroupControl: remove animated backdrop #38008

Merged

Conversation

KevinBatdorf
Copy link
Contributor

Description

This PR removes the backdrop animation component and replaces it with a simple background color change

This PR is an alternative solution to #37507

Fixes #37506

How has this been tested?

Tested by adding a component with a background color and swapping between gradient and solid. Also, when the container is focused, pressing the left and right arrow keys properly applies the background color.

Screenshots

Screen.Recording.2022-01-15.at.5.01.13.PM.mov

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).
  • I've updated related schemas if appropriate.

@ciampo ciampo requested review from mirka and ciampo January 19, 2022 21:41
@ciampo ciampo added this to In progress (owned) ⏳ in WordPress Components via automation Jan 19, 2022
@ciampo ciampo added [Feature] Component System WordPress component system [Package] Components /packages/components [Type] Bug An existing feature does not function as intended labels Jan 19, 2022
@ciampo ciampo changed the title Remove toggle group control backdrop feature ToggleGroupControl: remove animated backdrop Jan 19, 2022
Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

Thank you @KevinBatdorf for opening this PR!

The code changes test well, and overall LGTM. Would you be able to add an entry to the CHANGELOG?

The e2e failures don't seem related, maybe rebasing could be enough to have them pass.

@@ -49,7 +48,7 @@ function ToggleGroupControl(
} = useContextSystem( props, 'ToggleGroupControl' );
const cx = useCx();
const containerRef = useRef();
const [ resizeListener, sizes ] = useResizeAware();
const [ resizeListener ] = useResizeAware();
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like react-resize-aware was only needed to resize the backdrop, and so I think we can remove this line and the import at the top of this file (cc'ing @ntsekouras for a confirmation!)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense actually. The listener isn't very useful if the sizes aren't being used. I removed it for now

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it seems it can be safely removed.

@KevinBatdorf
Copy link
Contributor Author

Hey @ciampo I added the changelog and removed the listener. I also had to update the test to remove the listener too. Some of the tests are still failing, but I don't think they are related to this change?

Copy link
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

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

Thanks for your work and all the iterations @KevinBatdorf! 👏

LGTM and I agree with @ciampo about this being a better short-term solution for the issue.
With a green CI let's 🚢

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

Thank you Kevin, LGTM 🚀

@ciampo ciampo merged commit 84da37b into WordPress:trunk Jan 20, 2022
WordPress Components automation moved this from In progress (owned) ⏳ to Done 🎉 Jan 20, 2022
@github-actions github-actions bot added this to the Gutenberg 12.5 milestone Jan 20, 2022
@KevinBatdorf KevinBatdorf deleted the fix/change-toggle-control-active-state-css branch January 20, 2022 17:17
@jasmussen
Copy link
Contributor

Is there anything we can do to follow up and get the animated backdrop back in the next few days? Although I appreciate the need to fix separate bugs, this is a significant design regression.

@ciampo
Copy link
Contributor

ciampo commented Apr 4, 2022

Is there anything we can do to follow up and get the animated backdrop back in the next few days? Although I appreciate the need to fix separate bugs, this is a significant design regression.

Implementing this transition effectively and in a bug-free manner can prove quite complicated (see the complexity of the code changes in the last bug fix attempt in #37507), and I can't guarantee that I'll be able to come up with a solution in just a few days.

If, for the time being, you'd rather keep the older animation and reintroduce the bug that this PR fixed, I can go ahead an revert this PR. I will then work separately on a new implementation for the animation, and merge it when it's ready.

@jasmussen
Copy link
Contributor

We'll want to fix the bug, of course, but I'd prefer keeping the bug, and the backdrop until we can get both working at the same time. Thanks all for the work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Component System WordPress component system [Package] Components /packages/components [Type] Bug An existing feature does not function as intended
Projects
Development

Successfully merging this pull request may close these issues.

Color select component backdrop render and animation opportunities
4 participants