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

Resizable Box: Avoid paint on resizable-box handles #46196

Merged
merged 1 commit into from
Dec 2, 2022

Conversation

corentin-gautier
Copy link
Contributor

@corentin-gautier corentin-gautier commented Nov 30, 2022

What?

Avoid browser paint on resizable box handles animation

Why?

There's paint triggered when animating the resizable-box handle

How?

A simple will-change: transform avoids the repaint

Testing Instructions

  1. Open the dev console and enable the paint flashing (under rendering)
  2. Hover over a resizable block handle (image block for exemple)
  3. There shouldn't be paint on the handle

Screenshots

Before

Screen.Recording.2022-11-30.at.15.15.29.mov

After

Screen.Recording.2022-11-30.at.16.04.42.mov

@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @corentin-gautier! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Nov 30, 2022
@corentin-gautier corentin-gautier force-pushed the fix/resizable-box-paint branch 2 times, most recently from 6510f62 to dbddf98 Compare November 30, 2022 15:03
@skorasaurus skorasaurus added the [Type] Performance Related to performance efforts label Nov 30, 2022
@ciampo ciampo added the [Package] Components /packages/components label Nov 30, 2022
Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

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

Nice tweak @corentin-gautier 👍

This tests as advertised for me:

✅ Additional paint as avoided when applying this PR's changes
✅ ResizableBox component continues to look and function as per trunk in Storybook
✅ ResizableBox continues to function as before in the editor e.g. on Cover block

Before we merge this, we'll need a quick changelog entry given it touches the components package.

Example changelog diff
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 00c1aea07e..7a0d390654 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -15,6 +15,7 @@
 -   `TabPanel`: Add ability to set icon only tab buttons ([#45005](https://github.com/WordPress/gutenberg/pull/45005)).
 -   `InputControl`, `NumberControl`, `UnitControl`: Add `help` prop for additional description ([#45931](https://github.com/WordPress/gutenberg/pull/45931)).
 -   `CustomSelectControl`, `UnitControl`: Add `onFocus` and `onBlur` props ([#46096](https://github.com/WordPress/gutenberg/pull/46096)).
+-   `ResizableBox`: Prevent unnecessary paint on resize handles ([#46196](https://github.com/WordPress/gutenberg/pull/46196))
 
 ### Experimental
 

@corentin-gautier
Copy link
Contributor Author

@aaronrobertshaw I added the changelog entry 👍

@ciampo ciampo merged commit c64b751 into WordPress:trunk Dec 2, 2022
@github-actions github-actions bot added this to the Gutenberg 14.8 milestone Dec 2, 2022
@corentin-gautier corentin-gautier deleted the fix/resizable-box-paint branch December 5, 2022 10:13
mpkelly pushed a commit to mpkelly/gutenberg that referenced this pull request Dec 7, 2022
add changelog entry

Co-authored-by: Corentin Gautier <corentin.gautier@consertotech.pro>
@ryanwelcher ryanwelcher changed the title Avoid paint on resizable-box handles Resizable Box: Avoid paint on resizable-box handles Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Components /packages/components [Type] Performance Related to performance efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants