-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Allow flex justification controls to be disabled at the block level #67059
Conversation
Size Change: +11 B (0%) Total Size: 1.82 MB
ℹ️ View Unchanged
|
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.
Code looks good to me, and setting "allowJustification": false
in block.json toggles the controls in the toolbar and in the block settings sidebar
When settings "allowJustification": false
in block.json:
Trunk | This PR |
---|---|
the sidebar will look a bit empty:
Better working than empty looking for now is my 2c!
@@ -66,16 +66,19 @@ export default { | |||
onChange, | |||
layoutBlockSupport = {}, | |||
} ) { | |||
const { allowOrientation = true } = layoutBlockSupport; | |||
const { allowOrientation = true, allowJustification = true } = |
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.
Just double checking the PR's description:
This PR updates the controls so they are only output when allowJustification is true.
Is it right that true
is the default?
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.
Is it right that true is the default?
Yes!
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
onChange={ onChange } | ||
/> | ||
</FlexItem> | ||
) } | ||
<FlexItem> | ||
{ allowOrientation && ( |
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.
Can we not render FlexItem
if ! allowOrientation
? It was from before, but we can update it here.
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, updated!
What?
Fixes an issue noticed while reviewing #67022.
The
allowJustification
property of layout support should, per the docs allow disabling justification controls for the block in constrained or flex layouts, but currently flex justification controls are being rendered regardless of that property.This PR updates the controls so they are only output when
allowJustification
istrue
.Testing Instructions
buttons/block.json
update the layout support to:Note that if orientation controls are enabled (which they are by default), the sidebar will look a bit empty:
But that's already the case when justification is enabled and orientation is disabled (which has been a working feature for a while now):