-
Notifications
You must be signed in to change notification settings - Fork 805
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
Site Editor Compatibility: Fix layout of latest instagram posts cross browser #19529
Conversation
Caution: This PR has changes that must be merged to WordPress.com |
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
Thanks for working on this one @aaronrobertshaw! It's looking good when the feed is made up of square images. On my Instagram, though, I've got a range of image sizes from square to portrait and landscape. On the front end (and in the post editor before this change), the images get the portrait layout (perhaps because the first image is portrait?) and the
I'm not quite sure what the solution is... would it be possible for the |
I'll take another run at it. Browsers seem to differ on how they calculate their layouts for flex and grid. In Safari for example the 100% in the editor is causing the grid rows to get the full image height. |
@andrewserong I believe the handling of varying aspect ratios has been fixed now if you'd like to give it another try. It's working for me across browsers with a mix of landscape, square and portrait images. Rather than forcing 100% height, the new approach relies on letting the flex layout grow the image to the appropriate height. |
Nice, that's fixed that up @aaronrobertshaw. In Chrome, Firefox, and Safari, the images are rendering at the correct full height now. Unfortunately, I noticed another issue on Safari that isn't present before this change in the post editor... it looks like the image spacing slider isn't working in Safari, but is working for me in Firefox and Chrome. I also notice that in Safari click out and into the block is inconsistent as to whether or not it registers the block as being selected, but I'm not sure whether that's an issue in FSE, or with this CSS change. |
Thanks for the thorough testing, one step forwards...two steps back 🙂 I'll work on resolving the new issues tomorrow. |
Thanks for persevering with it! 🙂 |
After a quick test, it appears for me that changing the image spacing doesn't force Safari to redraw the grid. If I adjust the value, save the post and reload. The correct spacing is displayed. Toggling the any of the grid styles in Safari's dev tools force it to update as well. |
It turns out that the inline padding on grid children is required to cause Safari to redraw the grid. This padding was previously removed via a The theory is with a change in the display type and the stylesheets being copied into the site editor's iframe, the order in which the inline styles are applied might be different. This results in the The current working solution is to remove that If anyone has any better, less hacky, ideas on solving this one, I'd be happy to hear them! Otherwise, some extra testing would be helpful 🙂 |
Nice sleuthing on this one! I've tested the following in Chrome, Firefox, Edge and Safari in both site and block editors: ✅ Instagram images appear as expected (cover, and not stretched) On the frontend the correct inline style is applied for the grid gap. Here I chose |
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.
Tested across desktop browsers
Image-stretch as well as spacing adjustment is resolved in Safari. Looks good in other browsers as well.
🎉
@aaronrobertshaw this is testing well at desktop sizes for me across Safari, Chrome, FF and Edge. However, I think it introduces a regression for the Stack on mobile layout. If that's deselected, then the mobile view correctly has spacing: If I select stack on mobile, and then view in a narrow viewport, I get this before and after (tested in the post editor on a Varia theme):
So, I wonder if that was another thing that depended on the padding? |
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.
Nice, that's done the trick, the responsive stacked view on mobile is working for me now. Just did a quick smoke test in desktop Safari and Chrome too, and looking good. Thanks for following up with all the edge cases @aaronrobertshaw! 👍
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.
This tests well for me. I only have one minor remark.
projects/plugins/jetpack/extensions/blocks/instagram-gallery/instagram-gallery.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Jeremy Herve <[email protected]>
8cc148c
to
4106c6f
Compare
Great news! One last step: head over to your WordPress.com diff, D60136-code, and commit it. Thank you! |
Deployed: rWP224580 |
Fixes #19466
Changes proposed in this Pull Request:
Does this pull request change what data or activity we track or use?
No change.
Testing instructions:
Screenshots