Skip to content
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

Post Title Block: Custom margin applied to Headings does is not reflected in the front-end #35522

Closed
kjellr opened this issue Oct 11, 2021 · 8 comments · Fixed by #35772
Closed
Assignees
Labels
[Block] Post Title Affects the Post Title Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@kjellr
Copy link
Contributor

kjellr commented Oct 11, 2021

If a custom margin values are manually added to the Post Title block via block markup, they're reflected in the editor, but are not present in the front-end.

Sample markup

<!-- wp:post-title {"style":{"spacing":{"margin":{"top":"0px","bottom":"0px"}}} /-->

Or, here's a block pattern that uses this markup:

<!-- wp:post-template -->
<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"verticalAlignment":"top","width":"160px"} -->
<div class="wp-block-column is-vertically-aligned-top" style="flex-basis:160px"><!-- wp:post-date {"fontSize":"small"} /--></div>
<!-- /wp:column -->

<!-- wp:column {"verticalAlignment":"center","width":"75%"} -->
<div class="wp-block-column is-vertically-aligned-center" style="flex-basis:75%"><!-- wp:post-title {"isLink":true,"style":{"spacing":{"margin":{"top":"0px","bottom":"0px"}},"typography":{"fontSize":"clamp(3rem, 6vw, 4rem)"}}} /--></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:separator {"className":"is-style-wide"} -->
<hr class="wp-block-separator is-style-wide"/>
<!-- /wp:separator -->
<!-- /wp:post-template -->

Screenshots

Editor Front-end
Screen Shot 2021-10-11 at 1 58 54 PM Screen Shot 2021-10-11 at 1 59 08 PM
Editor Front-end
Screen Shot 2021-10-11 at 1 57 27 PM Screen Shot 2021-10-11 at 1 57 47 PM
@kjellr kjellr added [Type] Bug An existing feature does not function as intended [Block] Post Title Affects the Post Title Block labels Oct 11, 2021
@carolinan
Copy link
Contributor

I learnt that this is true not only for the post title but also paragraphs, navigation.

@colorful-tones
Copy link
Member

I believe this would require a larger rollout of margin support for pertinent blocks, correct? So, we would need to determine whether the Post Title is worthy of margin support.

I'm just trying to provide a bit further context.

Related Pull Requests and Issues

  1. Spacing Support: Add margin block support with configurable sides #30608
  2. Group Block: Add support for margin control to the group block #33909

@Mamaduka
Copy link
Member

@colorful-tones is right. The margin attributes won't be saved if the block doesn't support "spacing."

@kjellr
Copy link
Contributor Author

kjellr commented Oct 13, 2021

@mtias do you know of a reason we don't just enable spacing globally (for block themes at least)?

@colorful-tones
Copy link
Member

@kjellr I just dropped a request for update on parent Issue: Consistent dimension controls across blocks. #28356. Trying to keep the boulder moving. 😄 👍

@kjellr
Copy link
Contributor Author

kjellr commented Oct 14, 2021

Thanks, @colorful-tones!

@colorful-tones
Copy link
Member

@kjellr I've got a PR opened to try and get margin spacing support in for Post Title block: Post Title block - add spacing.margin support #35684

@MaggieCabrera
Copy link
Contributor

This is happening with padding too, when applied to the markup of the template, it only shows up with padding in the editor, not the frontend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Title Affects the Post Title Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants