Skip to content

Commit

Permalink
Check if spacing tool is defined before displaying controls. (#53008)
Browse files Browse the repository at this point in the history
* Check if spacing tool is defined before displaying controls.

* Don't show sides if spacing type false
  • Loading branch information
tellthemachines authored Jul 27, 2023
1 parent 50f9cbf commit 41b6e4b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/block-editor/src/components/global-styles/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ export function useSettingsForBlockElement(
const sides = Array.isArray( supports?.spacing?.[ key ] )
? supports?.spacing?.[ key ]
: supports?.spacing?.[ key ]?.sides;
if ( sides?.length ) {
// Check if spacing type is supported before adding sides.
if ( sides?.length && updatedSettings.spacing?.[ key ] ) {
updatedSettings.spacing = {
...updatedSettings.spacing,
[ key ]: {
Expand Down

1 comment on commit 41b6e4b

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 41b6e4b.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5677500985
📝 Reported issues:

Please sign in to comment.