Fixed Random Collapse of Colors Setting Section #32388
Open
+16
−12
Conversation
@@ -246,9 +246,7 @@ export const withBlockControls = createHigherOrderComponent( | |||
const withElementsStyles = createHigherOrderComponent( | |||
( BlockListBlock ) => ( props ) => { | |||
const elements = props.attributes.style?.elements; | |||
if ( ! elements ) { | |||
return <BlockListBlock { ...props } />; |
youknowriad
Jun 2, 2021
Contributor
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.
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 |
youknowriad
Jun 2, 2021
Contributor
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.
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
thisissandip commentedJun 2, 2021
•
edited
Fixes #32295
Description
Fixed Random Collapse of Colors Setting Section on various selection.
The collapse used to occur when the link color is:
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?
Screenshots
Color.Collapse.Fix.Test.mov
Types of changes
Bug fix
Checklist:
``