Skip to content
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

fix(css): remove screen condition from media queries #11142

Merged
merged 5 commits into from
Jun 5, 2024

Conversation

pepelsbey
Copy link
Contributor

Summary

It removes parts of @media conditions we don’t actually use:

// before
@media screen and (…) {}

// after
@media (…) {}

Problem

Right now

  • There are 196 @media screen and (…) conditions
  • There are 7 @media (…) conditions

It seems like we don’t write CSS exclusively for screen but rather for all:

<link href="/static/css/main.307bbe4e.css" rel="stylesheet">

Since there’s no media="screen" on that element, all our styles outside of @media have implicit media all, but the ones inside @media are screen only for some reason.

The only effect @media screen and (…) has right now is that these adaptive styles don’t apply for printing. It doesn’t seem intentional. For printing, we use inlined <style media="print"> that overrides styles for all and screen the same way.

Solution

Remove unused parts of @media conditions.


How did you test this change?

I ran it locally and couldn’t find any difference.

@pepelsbey pepelsbey requested a review from a team as a code owner May 16, 2024 09:20
@github-actions github-actions bot added plus work around features related to MDN Plus placement blog plus:playground plus:ai-help labels May 16, 2024
@pepelsbey pepelsbey added enhancement Improves an existing feature. and removed plus work around features related to MDN Plus placement plus:playground plus:ai-help blog labels May 16, 2024
@github-actions github-actions bot added plus work around features related to MDN Plus placement blog plus:playground plus:ai-help labels May 20, 2024
@pepelsbey pepelsbey requested a review from mdn-bot as a code owner May 23, 2024 09:24
@github-actions github-actions bot added dependencies Pull requests that update a dependency file deployer Deployment (currently using AWS S3 and AWS Lambda) cloud-function labels May 23, 2024
@pepelsbey pepelsbey removed dependencies Pull requests that update a dependency file plus work around features related to MDN Plus deployer Deployment (currently using AWS S3 and AWS Lambda) placement cloud-function labels May 23, 2024
@github-actions github-actions bot added plus work around features related to MDN Plus placement blog plus:playground plus:ai-help labels May 23, 2024
@pepelsbey pepelsbey removed plus work around features related to MDN Plus placement blog plus:playground plus:ai-help labels May 23, 2024
@github-actions github-actions bot added plus work around features related to MDN Plus placement blog plus:playground plus:ai-help labels Jun 5, 2024
@caugner caugner changed the title fix(css): remove screen and from MQ fix(css): remove screen condition from media queries Jun 5, 2024
Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. There's a small chance that this has an impact on the print layout, but the effect of those conditions on the print layout is most likely not intended in the first place.

@caugner caugner merged commit a814540 into mdn:main Jun 5, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blog enhancement Improves an existing feature. placement plus:ai-help plus:playground plus work around features related to MDN Plus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants