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

Make sure amp styles work with logo centering #887

Merged
merged 1 commit into from
Apr 28, 2020

Conversation

laurelfulford
Copy link
Contributor

All Submissions:

Changes proposed in this Pull Request:

There is a weird case where AMP will add the following CSS to a site, and it will cause the centred logo not to work when they have a width, height and sizes attribute:

[width][height][sizes]:not(.i-amphtml-layout-responsive) {
    display: block;
    position: relative;
}

This PR adds some 'backup' CSS in this cases, so rather than relying on the img to be display: inline-block, it will also work when it's display block.

How to test the changes in this Pull Request:

  1. Test on a site that's displaying this issue.
  2. Confirm that the logo is not centring.
  3. Apply the PR and run npm run build.
  4. Confirm that it fixes the issue.
  5. If possible, test on a site that is not displaying this issue on master and confirm that it doesn't cause any issues.

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?

@laurelfulford laurelfulford added the [Status] Needs Review The issue or pull request needs to be reviewed label Apr 20, 2020
@jeffersonrabb
Copy link
Contributor

Here are the conditions to replicate the issue:

  • AMP transitional mode
  • Center Logo theme mod
  • Newpack Pop-ups installed

Newspack Pop-ups enqueues various AMP scripts even if the request is non-AMP, which is probably the cause of the issue.

Copy link
Contributor

@jeffersonrabb jeffersonrabb left a comment

Choose a reason for hiding this comment

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

Fix works great.

@jeffersonrabb jeffersonrabb added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Apr 28, 2020
@laurelfulford
Copy link
Contributor Author

Thanks Jeff!

@laurelfulford laurelfulford merged commit 0aaec4c into master Apr 28, 2020
@laurelfulford laurelfulford deleted the fixes/logo-not-centring branch April 28, 2020 17:18
matticbot pushed a commit that referenced this pull request Apr 29, 2020
## [1.6.1](v1.6.0...v1.6.1) (2020-04-29)

### Bug Fixes

* add a temporary fix for a doubled block button outline ([#907](#907)) ([57df314](57df314))
* add color selectors for the editor ([#898](#898)) ([6e94411](6e94411))
* improve appearance of caption with beside featured image setting ([#882](#882)) ([1da6e44](1da6e44))
* make sure amp styles work with logo centering ([#887](#887)) ([0aaec4c](0aaec4c))
* make sure first floated element has top margin ([#903](#903)) ([733d482](733d482))
* tweak primary menu to be properly centred ([#884](#884)) ([9897cb1](9897cb1))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.6.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released [Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants