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

Fixed Random Collapse of Colors Setting Section #32388

Conversation

thisissandip
Copy link
Contributor

@thisissandip thisissandip commented Jun 2, 2021

Fixes #32295

Description

Fixed Random Collapse of Colors Setting Section on various selection.

The collapse used to occur when the link color is:

  1. selected for the first time
  2. removed/cleared and text/Background color settings are selected right after that.

This was happening because the withElementsStyles HOC returned different components when the link color is set and when it's not. Instead, withElementsStyles HOC should return a single component with different props based on the link color using conditional rendering.

How has this been tested?

  1. Select Block which supports color settings (eg. paragraph block)
  2. Open sidebar settings.
  3. Open Colors and select a custom color from one of the options.
  4. The color settings panel should not collapse like it used to before.

Screenshots

Color.Collapse.Fix.Test.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.

``

@@ -246,9 +246,7 @@ export const withBlockControls = createHigherOrderComponent(
const withElementsStyles = createHigherOrderComponent(
( BlockListBlock ) => ( props ) => {
const elements = props.attributes.style?.elements;
if ( ! elements ) {
return <BlockListBlock { ...props } />;
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this causes a remount which is not great for BlockEdit components. We had similar issues in other hooks in the past. So yeah the fix here is looking good to me.

} }
/>
{ elements && (
<style
Copy link
Contributor

Choose a reason for hiding this comment

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

Aside: (something for other PRs) Also noting that inline styles like that (which we do in layout as well), can cause CSS issues due to the new elements breaking :first-child selectors and things like that in editor styles.

@jorgefilipecosta @nosolosw @ellatrix We may need a dedicated way to inject these styles in the editor (and maybe even in the frontend) that doesn't suffer from these issues.

@youknowriad youknowriad added [Type] Bug An existing feature does not function as intended Backport to WP 6.6 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Jun 2, 2021
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.

Let's get this in. We can address the "style elements" issue separately.

@youknowriad youknowriad merged commit 696d64b into WordPress:trunk Jun 3, 2021
@github-actions github-actions bot added this to the Gutenberg 10.9 milestone Jun 3, 2021
@thisissandip
Copy link
Contributor Author

@youknowriad Thank you for reviewing and merging this PR! 😄

@youknowriad youknowriad removed the Backport to WP 6.6 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Jun 7, 2021
pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Jun 8, 2021
This includes the following fixes:


Widgets Editor:
  - Load widgets.php WordPress/gutenberg#32299
 - Fix Legacy Widget Preview WordPress/gutenberg#32300
 - Fix error when saving empty Legacy Widget block WordPress/gutenberg#32359

Widget blocks in the customizer: 
 - Fix deselection blocks when the inspector is open WordPress/gutenberg#32361
 - Display wide widgets as popovers WordPress/gutenberg#31736

Global Styles:
 - Align classNames generation between client and server WordPress/gutenberg#32352
 - Group typography block supports WordPress/gutenberg#32252 WordPress/gutenberg#32444 WordPress/gutenberg#32459
 - Make theme.json syntax errors more visible to the users WordPress/gutenberg#32404


Template Editor:
  - Update the appearance of the template details WordPress/gutenberg#32042
  - Fix layout definition WordPress/gutenberg#32425
  - Fix grouping post content block WordPress/gutenberg#32453

Miscellaneous:
 - Prevent saving when the post is locked WordPress/gutenberg#32341
 - Fix allowed block patterns selector WordPress/gutenberg#32376
 - Fix wrong results in the Post Author picker WordPress/gutenberg#32344
 - Fix notices position in top toolbar mode WordPress/gutenberg#32238
 - Allow non-latin characters in post slugs WordPress/gutenberg#32232
 - Fix Random collapse of the color settings panel WordPress/gutenberg#32388
 - Fix theme logo theme mode not being removed on theme removal WordPress/gutenberg#32370
 - Fix block alignment styles in the editor WordPress/gutenberg#32454
 - Fix some block toolbar overlaps WordPress/gutenberg#32424
 - Fix content loss when switching list types WordPress/gutenberg#32432


Performance:
 - Improve the performance of buttons block WordPress/gutenberg#32356
 - Improve the performance of the container blocks WordPress/gutenberg#32380

Props noisysocks, nosolosw, jorgefilipecosta.
See #52991.


git-svn-id: https://develop.svn.wordpress.org/trunk@51089 602fd350-edb4-49c9-b593-d223f7449a82
nylen pushed a commit to nylen/wordpress-develop-svn that referenced this pull request Jun 8, 2021
This includes the following fixes:


Widgets Editor:
  - Load widgets.php WordPress/gutenberg#32299
 - Fix Legacy Widget Preview WordPress/gutenberg#32300
 - Fix error when saving empty Legacy Widget block WordPress/gutenberg#32359

Widget blocks in the customizer: 
 - Fix deselection blocks when the inspector is open WordPress/gutenberg#32361
 - Display wide widgets as popovers WordPress/gutenberg#31736

Global Styles:
 - Align classNames generation between client and server WordPress/gutenberg#32352
 - Group typography block supports WordPress/gutenberg#32252 WordPress/gutenberg#32444 WordPress/gutenberg#32459
 - Make theme.json syntax errors more visible to the users WordPress/gutenberg#32404


Template Editor:
  - Update the appearance of the template details WordPress/gutenberg#32042
  - Fix layout definition WordPress/gutenberg#32425
  - Fix grouping post content block WordPress/gutenberg#32453

Miscellaneous:
 - Prevent saving when the post is locked WordPress/gutenberg#32341
 - Fix allowed block patterns selector WordPress/gutenberg#32376
 - Fix wrong results in the Post Author picker WordPress/gutenberg#32344
 - Fix notices position in top toolbar mode WordPress/gutenberg#32238
 - Allow non-latin characters in post slugs WordPress/gutenberg#32232
 - Fix Random collapse of the color settings panel WordPress/gutenberg#32388
 - Fix theme logo theme mode not being removed on theme removal WordPress/gutenberg#32370
 - Fix block alignment styles in the editor WordPress/gutenberg#32454
 - Fix some block toolbar overlaps WordPress/gutenberg#32424
 - Fix content loss when switching list types WordPress/gutenberg#32432


Performance:
 - Improve the performance of buttons block WordPress/gutenberg#32356
 - Improve the performance of the container blocks WordPress/gutenberg#32380

Props noisysocks, nosolosw, jorgefilipecosta.
See #52991.


git-svn-id: https://develop.svn.wordpress.org/trunk@51089 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Jun 8, 2021
This includes the following fixes:


Widgets Editor:
  - Load widgets.php WordPress/gutenberg#32299
 - Fix Legacy Widget Preview WordPress/gutenberg#32300
 - Fix error when saving empty Legacy Widget block WordPress/gutenberg#32359

Widget blocks in the customizer: 
 - Fix deselection blocks when the inspector is open WordPress/gutenberg#32361
 - Display wide widgets as popovers WordPress/gutenberg#31736

Global Styles:
 - Align classNames generation between client and server WordPress/gutenberg#32352
 - Group typography block supports WordPress/gutenberg#32252 WordPress/gutenberg#32444 WordPress/gutenberg#32459
 - Make theme.json syntax errors more visible to the users WordPress/gutenberg#32404


Template Editor:
  - Update the appearance of the template details WordPress/gutenberg#32042
  - Fix layout definition WordPress/gutenberg#32425
  - Fix grouping post content block WordPress/gutenberg#32453

Miscellaneous:
 - Prevent saving when the post is locked WordPress/gutenberg#32341
 - Fix allowed block patterns selector WordPress/gutenberg#32376
 - Fix wrong results in the Post Author picker WordPress/gutenberg#32344
 - Fix notices position in top toolbar mode WordPress/gutenberg#32238
 - Allow non-latin characters in post slugs WordPress/gutenberg#32232
 - Fix Random collapse of the color settings panel WordPress/gutenberg#32388
 - Fix theme logo theme mode not being removed on theme removal WordPress/gutenberg#32370
 - Fix block alignment styles in the editor WordPress/gutenberg#32454
 - Fix some block toolbar overlaps WordPress/gutenberg#32424
 - Fix content loss when switching list types WordPress/gutenberg#32432


Performance:
 - Improve the performance of buttons block WordPress/gutenberg#32356
 - Improve the performance of the container blocks WordPress/gutenberg#32380

Props noisysocks, nosolosw, jorgefilipecosta.
See #52991.

Built from https://develop.svn.wordpress.org/trunk@51089


git-svn-id: http://core.svn.wordpress.org/trunk@50698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
gMagicScott pushed a commit to gMagicScott/core.wordpress-mirror that referenced this pull request Jun 8, 2021
This includes the following fixes:


Widgets Editor:
  - Load widgets.php WordPress/gutenberg#32299
 - Fix Legacy Widget Preview WordPress/gutenberg#32300
 - Fix error when saving empty Legacy Widget block WordPress/gutenberg#32359

Widget blocks in the customizer: 
 - Fix deselection blocks when the inspector is open WordPress/gutenberg#32361
 - Display wide widgets as popovers WordPress/gutenberg#31736

Global Styles:
 - Align classNames generation between client and server WordPress/gutenberg#32352
 - Group typography block supports WordPress/gutenberg#32252 WordPress/gutenberg#32444 WordPress/gutenberg#32459
 - Make theme.json syntax errors more visible to the users WordPress/gutenberg#32404


Template Editor:
  - Update the appearance of the template details WordPress/gutenberg#32042
  - Fix layout definition WordPress/gutenberg#32425
  - Fix grouping post content block WordPress/gutenberg#32453

Miscellaneous:
 - Prevent saving when the post is locked WordPress/gutenberg#32341
 - Fix allowed block patterns selector WordPress/gutenberg#32376
 - Fix wrong results in the Post Author picker WordPress/gutenberg#32344
 - Fix notices position in top toolbar mode WordPress/gutenberg#32238
 - Allow non-latin characters in post slugs WordPress/gutenberg#32232
 - Fix Random collapse of the color settings panel WordPress/gutenberg#32388
 - Fix theme logo theme mode not being removed on theme removal WordPress/gutenberg#32370
 - Fix block alignment styles in the editor WordPress/gutenberg#32454
 - Fix some block toolbar overlaps WordPress/gutenberg#32424
 - Fix content loss when switching list types WordPress/gutenberg#32432


Performance:
 - Improve the performance of buttons block WordPress/gutenberg#32356
 - Improve the performance of the container blocks WordPress/gutenberg#32380

Props noisysocks, nosolosw, jorgefilipecosta.
See #52991.

Built from https://develop.svn.wordpress.org/trunk@51089


git-svn-id: https://core.svn.wordpress.org/trunk@50698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@youknowriad
Copy link
Contributor

Check-picked into 10.8 release branch

F-Wilke pushed a commit to FiliagoDev/WordPress that referenced this pull request Jul 31, 2021
This includes the following fixes:


Widgets Editor:
  - Load widgets.php WordPress/gutenberg#32299
 - Fix Legacy Widget Preview WordPress/gutenberg#32300
 - Fix error when saving empty Legacy Widget block WordPress/gutenberg#32359

Widget blocks in the customizer: 
 - Fix deselection blocks when the inspector is open WordPress/gutenberg#32361
 - Display wide widgets as popovers WordPress/gutenberg#31736

Global Styles:
 - Align classNames generation between client and server WordPress/gutenberg#32352
 - Group typography block supports WordPress/gutenberg#32252 WordPress/gutenberg#32444 WordPress/gutenberg#32459
 - Make theme.json syntax errors more visible to the users WordPress/gutenberg#32404


Template Editor:
  - Update the appearance of the template details WordPress/gutenberg#32042
  - Fix layout definition WordPress/gutenberg#32425
  - Fix grouping post content block WordPress/gutenberg#32453

Miscellaneous:
 - Prevent saving when the post is locked WordPress/gutenberg#32341
 - Fix allowed block patterns selector WordPress/gutenberg#32376
 - Fix wrong results in the Post Author picker WordPress/gutenberg#32344
 - Fix notices position in top toolbar mode WordPress/gutenberg#32238
 - Allow non-latin characters in post slugs WordPress/gutenberg#32232
 - Fix Random collapse of the color settings panel WordPress/gutenberg#32388
 - Fix theme logo theme mode not being removed on theme removal WordPress/gutenberg#32370
 - Fix block alignment styles in the editor WordPress/gutenberg#32454
 - Fix some block toolbar overlaps WordPress/gutenberg#32424
 - Fix content loss when switching list types WordPress/gutenberg#32432


Performance:
 - Improve the performance of buttons block WordPress/gutenberg#32356
 - Improve the performance of the container blocks WordPress/gutenberg#32380

Props noisysocks, nosolosw, jorgefilipecosta.
See #52991.

Built from https://develop.svn.wordpress.org/trunk@51089


git-svn-id: http://core.svn.wordpress.org/trunk@50698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Block Settings: Colors section randomly collapses/loses focus
2 participants