Skip to content

Mobile/Tablet/Desktop Previews do not work with externally loaded CSS  #21193

@roo2

Description

@roo2

Describe the bug
On wordpress.com we use stylesheets loaded from s0.wp.com, s1.wp.com for various plugins such as full-site-editing.
When we install the gutenberg plugin and use the mobile preview, some of the css still behaves as if in desktop mode, so we see columns on mobile preview etc.

image

To reproduce
Steps to reproduce the behavior:

  1. Install a plugin that loads styles from an external domain with mobile breakpoints (tested with the full-site-editing plugin)
  2. Open the gutenberg editor and attempt to mobile preview

Expected behavior
The columns should be stacked for mobile display. Preview should render as if in a mobile device.

Additional context
From our initial investigation, here is what appears to be happening:
Our current understanding of what's happening:

Mobile/tablet preview uses the use-simulated-media-query function which works by modifying the loaded stylesheets to simulate being viewed on mobile/tablet breakpoints.

This works for stylesheets loaded from the same domain. However, on wordpress.com, the static domains s0.wp.com and s1.wp.com are used to serve many stylesheets such as those from the full-site-editing-plugin.

These stylesheets are therefore rendered in desktop mode even when using mobile/tablet preview.

calypso issue: Automattic/wp-calypso#40401

Metadata

Metadata

Assignees

Labels

[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions