-
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
Show child layout controls by default #49389
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why it's not always a boolean?
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.
If I'm understanding properly, the check is less about type "boolean" and more about checking if the value is actually set to avoid considering "undefined" as "false".
I think I'd prefer if we stay consistent between all the default controls. We're considering undefined as false for all the default controls in all the
*Panel
components. So my question is: can we just keep it as is here? and update the "block.json" files for the blocks that override the default defaultControls instead?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, that's the point of this check.
That's exactly what this change addresses: we need to have a way of defaulting to true for the child layout controls, but still preserving the ability to override that if needed by setting it to false in block.json. Child layout controls can be applied to any block, including third party blocks, so it's not practical to explicitly set the controls to display for every single block type.
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.
I like the idea of exposing
false
as a valid value, and the idea that we can have some controls be opt-out (in terms of the default controls) rather than opt-in.If consistency for each of the controls is important, what if we used something like
isShownByDefault={ defaultControls.childLayout ?? FALLBACK_DEFAULT_CONTROLS.childLayout }
for each of the controls. Then,FALLBACK_DEFAULT_CONTROLS
could contain the global defaults we'd like to go with. So if all the others are hidden by default, it might be:Would something like that work? The idea's basically the same as this PR, but just that we could use the same approach as this PR for each of the other controls, with a const to contain our desired defaults.
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.
This works for me 👍
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.
Thanks for the suggestion! I'll give it a go. Note that doing that will also require us to explicitly set all the controls to
true
on the site editor side, given that currently the site editor isn't passing anydefaultControls
into the Dimensions panel, so it depends on the values fromDEFAULT_CONTROLS
to betrue
.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.
Ok I've added the suggested changes!