-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,9 +246,7 @@ export const withBlockControls = createHigherOrderComponent( | |
const withElementsStyles = createHigherOrderComponent( | ||
( BlockListBlock ) => ( props ) => { | ||
const elements = props.attributes.style?.elements; | ||
if ( ! elements ) { | ||
return <BlockListBlock { ...props } />; | ||
} | ||
|
||
const blockElementsContainerIdentifier = `wp-elements-${ useInstanceId( | ||
BlockListBlock | ||
) }`; | ||
|
@@ -259,17 +257,23 @@ const withElementsStyles = createHigherOrderComponent( | |
|
||
return ( | ||
<> | ||
<style | ||
dangerouslySetInnerHTML={ { | ||
__html: styles, | ||
} } | ||
/> | ||
{ elements && ( | ||
<style | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 @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. |
||
dangerouslySetInnerHTML={ { | ||
__html: styles, | ||
} } | ||
/> | ||
) } | ||
|
||
<BlockListBlock | ||
{ ...props } | ||
className={ classnames( | ||
props.classname, | ||
blockElementsContainerIdentifier | ||
) } | ||
className={ | ||
elements && | ||
classnames( | ||
props.classname, | ||
blockElementsContainerIdentifier | ||
) | ||
} | ||
/> | ||
</> | ||
); | ||
|
There was a problem hiding this comment.
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.