-
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
File block: Add spacing support #45107
Merged
Merged
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
017af05
File block: Add spacing support
carolinan 90d6346
Merge branch 'trunk' into update/file-spacing-support
carolinan cf727a8
Merge branch 'trunk' into update/file-spacing-support
carolinan ec8bbe6
tentatively add margin to classic.scss
carolinan 6c59b40
Update classic.scss
carolinan 39b239d
Merge branch 'trunk' into update/file-spacing-support
carolinan f4b6ecd
Merge branch 'trunk' into update/file-spacing-support
carolinan dcf14cd
Merge branch 'trunk' into update/file-spacing-support
carolinan 460905d
Merge branch 'trunk' into update/file-spacing-support
carolinan fd1d087
Merge branch 'trunk' into update/file-spacing-support
carolinan 137786d
Merge branch 'trunk' into update/file-spacing-support
carolinan 9256bb8
Merge branch 'trunk' into update/file-spacing-support
carolinan 3b55fc6
Merge branch 'trunk' into update/file-spacing-support
carolinan 7035826
Merge branch 'trunk' into update/file-spacing-support
carolinan b8bb5c2
Remove experimental bottom margin
carolinan 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
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.
Unfortunately, I don't think we can make this switch yet as it would be a regression for themes without a theme.json file due to the generated styles not being loaded for them.
See: #46818
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 mentioning this, and for linking through to the WIP work to fix layout conflicts with margins. Something that's also relevant here is that in the exploration by @tellthemachines over in #47858 the Columns block's default
margin-bottom
rule has its specificity reduced. The idea in that PR is that for layout rules to be able to have reduced specificity, we likely will also need all core blocks' default margin rules to be lower specificity too (e.g. wrapped in a:where()
rule) so that low specificity layout rules can easily override it. I imagine we'd need to do that for the file block, too.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.
There is a specific stylesheet loaded for them now though? The style should be added there.
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 wasn't aware there was. I was basing my comment off both #46818 and #45198 which are still open indicating the issue remains.
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.
Here is where the classic.scss file was introduced.
#44334
https://developer.wordpress.org/reference/functions/wp_enqueue_classic_theme_styles/
In 6.2 it uses
wp_theme_has_theme_json()
to determine when the file is loaded.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.
Thank you for trying out the classic.scss approach @carolinan
Unfortunately, I think things have changed a bit recently. #47858 landed which fixed the layout margin rule specificity. Part of that meant lowering the specificity of some blocks' CSS rules. This included the File block.
The current state of this PR means we would have the margin rule in 3 places (style.scss, classic.scss, and block.json).
I suspect we might be better off removing the addition of the new rule to
classic.scss
and theblock.json
via__experimentalStyle
. The latter overrides the lower margin specificity required to work alongside layout supports.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 don't think the layout margin rules are fixed, there are issues with two of the other blocks I have spacing PR's for.
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.
The "fixing" of margin rules was so that a block's global styles for margin could be applied. I believe the fix from #47858 is still working. It sounds like the interaction between the overall layout styles and top-level block margins is what you don't think is working correctly?
I'm about to start looking more closely at the Preformatted spacing PR.
The left/right margins not being applied for top-level blocks makes sense but I need to have a play around with the PR to see what's happening on the frontend. I'll comment further on that PR.
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.
Coming back to this one with fresh eyes, I still think we just need to remove the classic.scss style and this
__experimentalStyle
entry and we should be able to move ahead with this PR.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.
Removed 👍