Add mechanism to convert media queries into "element" queries #17057
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a run time mechanism that converts simple media queries e.g: max/min-width/height into element queries that reference the dimensions of .editor-styles-wrapper-container.
We are using https://github.com/marcj/css-element-queries as our element queries "polyfill".
There are some visual regressions in the customizer it happens because although the media queries evaluate as if the viewport was small our components (if/With)ViewportMatches still think the viewport is large.
I will create a separate PR that allows us to simulate widths in these components.
How has this been tested?
I verified things work as before and there are no visual regressions excluding in the customizer.
I added a rule that changes editor-styles-wrapper width to 550px:
In the editor styles.
I added media & text block, I enabled stack on mobile option and I verified the media & text got stacked even though the window continues to have a big size.