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

fix(homepage-posts): placement for inline styles #1611

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

miguelpeixe
Copy link
Member

All Submissions:

Changes proposed in this Pull Request:

The inline styles for the Homepage Posts block are not rendered right after .entry-content as documented in the code. They are rendered alongside the first rendered HPP block. This can cause containers that leverage pseudo classes like :first-child or :last-child to not behave as expected, since the style tag can get picked up.

Before After
image image

This PR changes the placement for the inline CSS so it's printed inside the block container. The improved CLS implemented in the original PR (#1548) should be preserved.

How to test the changes in this Pull Request:

  1. Confirm the bug by adding a 2 column block with a HPP block on each column and visiting the front-end (see image above)
  2. Check out this branch and confirm there's no longer a top margin on the first block
  3. Open DevTools, change to mobile viewport and apply network throttling to slow 3g (see Inline HPB styles in a style tag #1548 for further details if needed)
  4. Refresh the page and confirm the slowly rendered layout doesn't shift

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Copy link
Contributor

@laurelfulford laurelfulford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @miguelpeixe!! 🙌

This fixes the issue for me! I also checked through our theme and regular block styles, it looks like we don't rely on this div's position in any of our styles so adding another tag before shouldn't cause any problems unless there's a super-weird edge case out there!

@miguelpeixe
Copy link
Member Author

Thanks, Laurel!

@miguelpeixe miguelpeixe merged commit 1831ba0 into release Nov 27, 2023
9 checks passed
@miguelpeixe miguelpeixe deleted the hotfix/homepage-posts-inline-style-tag branch November 27, 2023 21:22
matticbot pushed a commit that referenced this pull request Nov 27, 2023
## [2.2.1](v2.2.0...v2.2.1) (2023-11-27)

### Bug Fixes

* **homepage-posts:** placement for inline styles ([#1611](#1611)) ([1831ba0](1831ba0))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants