autoprefixer icon indicating copy to clipboard operation
autoprefixer copied to clipboard

grid-area prefixing missing when multiple cells target the same grid-template-area

Open surfingsven opened this issue 8 years ago • 6 comments

This might be more of an edge-case...

Notice: #a and #b elements are targeting the same content cell which is valid in CSS grid as I understood it.

SCSS input:

.box {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 100px 1fr 50px;
    grid-template-areas: "header" "content" "footer";

    header {
        grid-area: header;
    }

    #a {
        grid-area: content;
    }

    #b {
        grid-area: content;
    }


    footer {
        grid-area: footer;
    }
}

CSS output:

Notice: -ms-grid-row and -ms-grid-column props are missing for #b.

.google-shopping.alternate-offer-lander .box {
  display: -ms-grid;
  display: grid;
  -ms-grid-columns: 1fr;
  grid-template-columns: 1fr;
  -ms-grid-rows: 100px 1fr 50px;
  grid-template-rows: 100px 1fr 50px;
  grid-template-areas: "header" "content" "footer";
}

.google-shopping.alternate-offer-lander .box header {
  -ms-grid-row: 1;
  -ms-grid-column: 1;
  grid-area: header;
}

.google-shopping.alternate-offer-lander .box #a {
  -ms-grid-row: 2;
  -ms-grid-column: 1;
  grid-area: content;
}

.google-shopping.alternate-offer-lander .box #b {
  grid-area: content;
}

.google-shopping.alternate-offer-lander .box footer {
  -ms-grid-row: 3;
  -ms-grid-column: 1;
  grid-area: footer;
}

surfingsven avatar Jan 30 '18 14:01 surfingsven

/cc @evgeny-petukhov

ai avatar Jan 30 '18 14:01 ai

Yeap! https://github.com/postcss/autoprefixer/blob/master/lib/hacks/grid-template-areas.js#L64 Now areas are removed from the array when it is used once. It was necessary in order to throw warning with unused areas. I'll fix it.

yepninja avatar Jan 30 '18 17:01 yepninja

@evgeny-petukhov tell me if you need any help. I can create Cult of Martians task for it.

ai avatar Feb 02 '18 16:02 ai

Sorry for the delay. I've fixed the bug here https://github.com/postcss/autoprefixer/pull/983

yepninja avatar Feb 07 '18 15:02 yepninja

Done https://github.com/postcss/autoprefixer/pull/983

ai avatar Feb 09 '18 22:02 ai

Released in 7.2.6.

ai avatar Feb 09 '18 22:02 ai