Fix Sass compilation when $color-mode-type
is set to media-query
#37687
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.
Description
As a summary, this PR fixes Sass compilation when
$color-mode-type
is set tomedia-query
.First error
So the first error mentioned in the issue was the following:
The main reason is that we had in
_root.scss
:So when we set
$color-mode-type
tomedia-query
we end up with a generated CSS for this part without any scope!I haven't found a better way for now to fix it so I've modified our
color-mode
mixin to:$color-mode-type
is available globally even within the mixin:root
scopeSecond and third errors
After having fixed this one, another type of error popped out (I don't have it, I forgot to register it) but that said that it's not possible to use
@extend
within@media
.So our
@extend
in close button and carousels didn't work.Instead of using
@extend
I've found a way (maybe not ideal) to replace it with a mixin.I kept the
test()
andtest2()
just for you to spot easily how it works, and also because I haven't found the proper wording :)Type of changes
Checklist
npm run lint
)Live previews
$color-media-type
set todata
and I tried within the doc to play with themedia-query
but our doc is not really very usable when we enable themedia-query
as is; so it was complicated to ensure that it works correctly. I might need someone to double check if it is OK 🙏Related issues
Closes #37673