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

[css-grid] Suppress IE warnings that are not relevant #1110

Closed
mikkelwf opened this Issue Sep 12, 2018 · 10 comments

Comments

Projects
None yet
3 participants
@mikkelwf

mikkelwf commented Sep 12, 2018

Hi

After updating to version 9.x (i've tried 9.0.2 and 9.1.3), I now get warnings for css-grid errors regarding IE (which is great btw).

One of them regards the use of auto-fill:

grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));

To make a fallback to IE i desided to just render the grid when auto-fill is supported, so i wrapped the code in @supports

  @supports (grid-template-columns: repeat(auto-fill, minmax(200px, 1fr))) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

However i still get the warning, even though IE never reaches the specific line, due to the @supports.
The warning is correct, but in context is wrong, and should not be shown to the user.

@Dan503

This comment has been minimized.

Show comment
Hide comment
@Dan503

Dan503 Sep 12, 2018

Contributor

You can use control comments to work around the issue.

This will turn off autoprefixer for the whole block

  @supports (grid-template-columns: repeat(auto-fill, minmax(200px, 1fr))) {
    /* autoprefixer: off */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

or you can turn it off for individual lines

  @supports (grid-template-columns: repeat(auto-fill, minmax(200px, 1fr))) {
    /* autoprefixer: ignore next */
    display: grid;
    /* autoprefixer: ignore next */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
Contributor

Dan503 commented Sep 12, 2018

You can use control comments to work around the issue.

This will turn off autoprefixer for the whole block

  @supports (grid-template-columns: repeat(auto-fill, minmax(200px, 1fr))) {
    /* autoprefixer: off */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

or you can turn it off for individual lines

  @supports (grid-template-columns: repeat(auto-fill, minmax(200px, 1fr))) {
    /* autoprefixer: ignore next */
    display: grid;
    /* autoprefixer: ignore next */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
@ai

This comment has been minimized.

Show comment
Hide comment
@ai

ai Sep 12, 2018

Member

I agree that we need to check parents for @supports before showing warning.

Member

ai commented Sep 12, 2018

I agree that we need to check parents for @supports before showing warning.

@ai

This comment has been minimized.

Show comment
Hide comment
@ai

ai Sep 12, 2018

Member

But this issue could take week or more, so using control comments is a good idea for now

Member

ai commented Sep 12, 2018

But this issue could take week or more, so using control comments is a good idea for now

@mikkelwf

This comment has been minimized.

Show comment
Hide comment
@mikkelwf

mikkelwf Sep 17, 2018

I can live with the warnings for now, so its super if you consider this feature. :D

mikkelwf commented Sep 17, 2018

I can live with the warnings for now, so its super if you consider this feature. :D

@ai

This comment has been minimized.

Show comment
Hide comment
@ai

ai Sep 18, 2018

Member

I sent this task to our Cult of Martians

Member

ai commented Sep 18, 2018

I sent this task to our Cult of Martians

@Dan503

This comment has been minimized.

Show comment
Hide comment
@Dan503

Dan503 Sep 22, 2018

Contributor

Do you think we can extend this to not just suppress warnings but also suppress IE prefixes?

Input CSS

.ie_grid {
  display: grid;
}

@supports (grid-gap: 0) {
  .modern_grid {
    display: grid;
  }
}

current output CSS

.ie_grid {
  display: -ms-grid;
  display: grid;
}

@supports (grid-gap: 0) {
  .modern_grid {
    /* this prefix is pointless */
    display: -ms-grid;
    display: grid;
  }
}

Expected output CSS

.ie_grid {
  display: -ms-grid;
  display: grid;
}

@supports (grid-gap: 0) {
  .modern_grid {
    display: grid;
  }
}
Contributor

Dan503 commented Sep 22, 2018

Do you think we can extend this to not just suppress warnings but also suppress IE prefixes?

Input CSS

.ie_grid {
  display: grid;
}

@supports (grid-gap: 0) {
  .modern_grid {
    display: grid;
  }
}

current output CSS

.ie_grid {
  display: -ms-grid;
  display: grid;
}

@supports (grid-gap: 0) {
  .modern_grid {
    /* this prefix is pointless */
    display: -ms-grid;
    display: grid;
  }
}

Expected output CSS

.ie_grid {
  display: -ms-grid;
  display: grid;
}

@supports (grid-gap: 0) {
  .modern_grid {
    display: grid;
  }
}
@Dan503

This comment has been minimized.

Show comment
Hide comment
@Dan503

Dan503 Sep 23, 2018

Contributor

The user can't necessarily use @supports (display: grid) because that gets prefixed to @supports (display: grid) or (display: -ms-grid) if IE 10 or old Edge support is emabled.

Contributor

Dan503 commented Sep 23, 2018

The user can't necessarily use @supports (display: grid) because that gets prefixed to @supports (display: grid) or (display: -ms-grid) if IE 10 or old Edge support is emabled.

@ai

This comment has been minimized.

Show comment
Hide comment
@ai

ai Sep 23, 2018

Member

Do you think we can extend this to not just suppress warnings but also suppress IE prefixes?

It will be strange if we will do it only for it only for Grid.

Let’s just suppress warnings.

Member

ai commented Sep 23, 2018

Do you think we can extend this to not just suppress warnings but also suppress IE prefixes?

It will be strange if we will do it only for it only for Grid.

Let’s just suppress warnings.

@Dan503

This comment has been minimized.

Show comment
Hide comment
@Dan503

Dan503 Sep 23, 2018

Contributor

The difference with grid though is that it has the capacity to output far more code than any other prefix.

Other prefixes generate maybe up to 3 lines of extra code. Often only one line of extra code.

Grid on the other hand can easily generate something like 50 lines of extra code.

Contributor

Dan503 commented Sep 23, 2018

The difference with grid though is that it has the capacity to output far more code than any other prefix.

Other prefixes generate maybe up to 3 lines of extra code. Often only one line of extra code.

Grid on the other hand can easily generate something like 50 lines of extra code.

@ai ai changed the title from css-grid: suppress IE warnings that are not relevant to [css-grid] suppress IE warnings that are not relevant Sep 30, 2018

@ai ai added the enhancement label Sep 30, 2018

@ai ai changed the title from [css-grid] suppress IE warnings that are not relevant to [css-grid] Suppress IE warnings that are not relevant Sep 30, 2018

@ai

This comment has been minimized.

Show comment
Hide comment
@ai

ai Oct 14, 2018

Member

Done 1a8f9a0

Member

ai commented Oct 14, 2018

Done 1a8f9a0

@ai ai closed this Oct 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment