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

mShots does not appear to render Mapbox embeds #30

Open
andrewserong opened this issue Feb 4, 2021 · 5 comments
Open

mShots does not appear to render Mapbox embeds #30

andrewserong opened this issue Feb 4, 2021 · 5 comments

Comments

@andrewserong
Copy link
Member

andrewserong commented Feb 4, 2021

It appears that mShots does not render Mapbox embeds. At first I thought this might be an issue with mShots not waiting long enough for JavaScript to complete executing, however we haven't managed to replicate the issue with other blocks. The hunch at the moment is that it's somehow particular to Mapbox and / or using <canvas>.

It looks like this on the front end of a real site:

pbYkd9-2R-p2

image

Via mShots it doesn't appear to finish loading before the screenshot is taken:

image

https://s0.wordpress.com/mshots/v1/https://andysfakeblockpatternsourcesite.wordpress.com/2021/01/29/test-map-layout/

@simison suggested in Automattic/wp-calypso#49101 that we might be able to adjust something in

const response = await page.goto( m_uri, { waitUntil: 'networkidle2' } ).
https://pptr.dev/#?product=Puppeteer&version=main&show=api-pagewaitfornavigationoptions

It's likely that this issue will be a blocker for a screenshots-based page layout picker in Calypso. Since this currently only affects one kind of block, it may not be a blocker, but would be a good thing to find a fix for eventually.

@ramonjd
Copy link
Member

ramonjd commented Feb 4, 2021

Do we know for sure that it's not waiting for full script execution?

Google maps load fine

Screen Shot 2021-02-04 at 7 41 25 pm

Screen Shot 2021-02-04 at 7 35 30 pm

But mapbox does not

Screen Shot 2021-02-04 at 7 41 33 pm

Both maps are in an iframe, but mapbox uses <canvas />

@andrewserong
Copy link
Member Author

Thanks for checking @ramonjd! I haven't been able to replicate this issue with any other blocks, so it might not be the full script execution issue at all, and could be something particular to Mapbox. I'll update the issue description to be more specific 🙂

@andrewserong andrewserong changed the title mShots does not wait for JavaScript to complete before taking a screenshot mShots does not appear Mapbox embeds Feb 4, 2021
@andrewserong
Copy link
Member Author

Updated the description to indicate that it's particular to Mapbox and therefore lower priority than I originally thought.

@andrewserong
Copy link
Member Author

It looks like the rendering issue via mShots might be resolved by upgrading Mapbox to > v2.1.0 (I suspect that the change in mapbox/mapbox-gl-js#10294 might have fixed it). Example url: https://s0.wp.com/mshots/v1/https://docs.mapbox.com/mapbox-gl-js/api/?vph=1200

The solution, then, will be to try upgrading Mapbox in Jetpack to see if that does the trick. I'll leave this issue open until we have a fix in place (also, just in case upgrading doesn't resolve the issue).

@andrewserong andrewserong changed the title mShots does not appear Mapbox embeds mShots does not appear to render Mapbox embeds Feb 26, 2021
@simison
Copy link
Member

simison commented May 18, 2021

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

No branches or pull requests

3 participants