-
Notifications
You must be signed in to change notification settings - Fork 159
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
Wrap imported CSS in an at scope rule #4613
Merged
Merged
Conversation
This file contains 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
Job #9572: Bundle Size — 63.6MiB (-0.04%).
Warning Bundle removed 3 duplicate packages, 75 duplicate packages remaining – View duplicate packages Bundle metrics
Bundle size by type
View job #9572 report View feature/at-rule-scoped-css branch activity |
Performance test results: |
1 similar comment
Performance test results: |
Rheeseyb
changed the title
(Draft) Wrap imported CSS in an at scope rule
Wrap imported CSS in an at scope rule
Dec 8, 2023
Rheeseyb
requested review from
gbalint,
seanparsons,
ruggi,
balazsbajorics,
liady and
bkrmendy
December 8, 2023 13:08
balazsbajorics
approved these changes
Dec 8, 2023
liady
approved these changes
Dec 8, 2023
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.
very nice
seanparsons
approved these changes
Dec 11, 2023
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.
Problem:
User CSS can affect the editor itself. This was fixed by #4604 (and the follow up patch #4611), but that approach is prone to edge cases.
Fix:
As we are primarily targeting Chrome, we can surround user's CSS in
@scope (#canvas-container){ ... }
at the point of importing in order to scope it to only within the canvas container itself. There are a small number of selectors (e.g.body
and:root
) that have to be replaced with the:scope
selector, but otherwise we can leave the remaining imported CSS untouched.I've had to update the version of puppeteer used so that we are now running the tests on a version of Chrome that supports this rule (as previously this was breaking the performance tests)
Notes:
@scope
is landing in Safari@scope
CSS @scope mozilla/standards-positions#472