Add mechanism to convert media queries into "element" queries#17057
Closed
jorgefilipecosta wants to merge 1 commit intomasterfrom
Closed
Add mechanism to convert media queries into "element" queries#17057jorgefilipecosta wants to merge 1 commit intomasterfrom
jorgefilipecosta wants to merge 1 commit intomasterfrom
Conversation
b12f646 to
5705307
Compare
5705307 to
c2d0d86
Compare
c2d0d86 to
fc2a82a
Compare
Contributor
|
I am so excited about this! Element queries, yay! 🎉 |
Member
Author
|
Given the problems we faced with transforming media queries in element queries namely: performance issues and CSS specificity changes, this PR is closed in favor of #17946. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.