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

First children that have a custom link color assigned have unnecessary top blockGap margin #35353

Closed
kjellr opened this issue Oct 5, 2021 · 0 comments · Fixed by #35425
Closed
Assignees
Labels
[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 5, 2021

Description

As noted in #34441, the current blockGap rules specify a top margin for blocks that appear after the first element. it is not intended to apply to first children.

This breaks when the first child has a custom link color assigned. When that's the case, Gutenberg provides some inline styles that precede the block. The browser seems to interpret this <style> element as the first child, and it applies the top margin to the block as if it were the second child of the parent.

Step-by-step reproduction instructions

Using a theme that enables blockGap, try the following markup:

<!-- wp:group {"style":{"color":{"background":"#cce2eb"}}} -->
<div class="wp-block-group has-background" style="background-color:#cce2eb"><!-- wp:paragraph {"style":{"elements":{"link":{"color":{"text":"#e5ff98"}}}}} -->
<p class="has-link-color">This is a group block with a custom link color.</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->

You'll notice that the top blockGap margin is applied to the paragraph block, even though it's the first child bock.

Screen Shot 2021-10-05 at 9 09 54 AM

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@kjellr kjellr added the [Type] Bug An existing feature does not function as intended label Oct 5, 2021
@kjellr kjellr changed the title First children that have custom colors assigned have unnecessary top margin First children that have a custom link color assigned have unnecessary top blockGap margin Oct 5, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[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.

2 participants