-
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
Gallery: re-enable block spacing at block level while still hiding in global styles #53900
Merged
Merged
Changes from all commits
Commits
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
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
Oops, something went wrong.
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.
I find it a bit weird that we allow something globally but not locally if
__experimentalSkipSerialization
is true. That flag indicates that we can't serialize so why serialize for global styles but not serialize for local styles?Assuming it's ok to do that, why are we doing this only for "block gap", it's probably not the only property that can have "__experimentalSkipSerialization".
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.
It is a weird check this one. The comment might be slightly ambiguous, but the logic is the inverse — for
blockGap
if__experimentalSkipSerialization
istrue
then we don't allow global styles to be set. From memory, the reason this logic was introduced is because of the unique case of the Gallery block where we can't (yet) allow block level global styles for it since that block always outputs block-level styles even if a local blockGap value isn't set.My longer-term preference would be for us to actually remove this edge case for block gap entirely, so
__experimentalSkipSerialization
wouldn't disable block-level global styles. To do so, I believe we'd need to update the post editor to include a global styles provider so that at the block level for the Gallery block we can check if a block-level global styles value exists before outputting the local block-level Gallery styles.I'll merge this PR in now, but happy to look into a proof of concept of how we might move away from this rule — it'll probably make the conversation a little clearer if we have some code to play with to look at an alternative 🙂
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.
Actually, that makes more sense. If it's the block author that provides the serialization, it makes sense to disable on global styles because I believe we have no way to define the "serialization" function in global styles output.
So maybe the best path forward here is to make this a generic rule for all block supports.