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

Media queries are dropped by sass under certain circumstances, leading to a different result than expected #1791

Closed
danieltroger opened this issue Aug 29, 2022 · 1 comment · Fixed by #1792
Assignees
Labels

Comments

@danieltroger
Copy link

danieltroger commented Aug 29, 2022

The outmost media query is dropped when containing the not keyword, when nesting three media queries inside each other.

Input:

body {
  @media not all and (hover: hover) and (pointer: fine) {
    @media (max-height: 1000px) {
      font-size: 12px;
      @media (max-width: 600px) {
        background: red;
      }
    }
  }
}

Output:

@media not all and (hover: hover) and (pointer: fine) {
  @media (max-height: 1000px) {
    body {
      font-size: 12px;
    }
  }
}
@media (max-height: 1000px) and (max-width: 600px) {
  body {
    background: red;
  }
}

As you can see the background:red no longer only happens on devices supporting hover and having a fine pointer.

Expected output

@media not all and (hover: hover) and (pointer: fine) {
  @media (max-height: 1000px) {
    body {
      font-size: 12px;
    }
  }
}
@media not all and (hover: hover) and (pointer: fine) {
  @media (max-height: 1000px) and (max-width: 600px) {
    body {
      background: red;
    }
  }
}

Sass version: 1.54.5 compiled with dart2js 2.17.6

@nex3 nex3 self-assigned this Aug 29, 2022
@nex3 nex3 added the bug label Aug 29, 2022
@nex3 nex3 transferred this issue from sass/sass Aug 29, 2022
nex3 added a commit to sass/sass-spec that referenced this issue Aug 29, 2022
nex3 added a commit that referenced this issue Aug 29, 2022
nex3 added a commit that referenced this issue Aug 29, 2022
nex3 added a commit to sass/sass-spec that referenced this issue Aug 29, 2022
@danieltroger
Copy link
Author

Thank you for the quick fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants