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

[css-grid] if area row/column span has been declared, row/column span needs to apply to all #1146

Closed
Dan503 opened this issue Oct 19, 2018 · 2 comments
Labels

Comments

@Dan503
Copy link
Contributor

Dan503 commented Oct 19, 2018

We have an issue where because a row/column span is being output into one rule but not the other, a rule is inheriting a row/column span that it is not supposed to inherit.

View this demo in IE and a modern browser for comparison:
https://s.codepen.io/daniel-tonon/debug/VExydO/vWkRwapxPvnM

Input CSS

.content {
  grid-area: content;
}

/* layout.scss */
.single-sidebar {
  display: grid;
  grid-template:
    "nav       content" 1fr
    "subscribe content" 1fr /
     1fr       2fr;
}

.double-sidebar {
  display: grid;
  grid-template:
    "nav    content   sidebar" 1fr
    "nav    subscribe sidebar" 1fr /
     1fr     2fr       1fr;
}

current output css

.content {
  -ms-grid-row: 1;
  -ms-grid-row-span: 2; /* <-- A row span has been output */
  -ms-grid-column: 2;
  grid-area: content;
}
.double-sidebar > .content {
  -ms-grid-row: 1;
   /* <-- No row span output to overide the other one */
  -ms-grid-column: 2;
}

.single-sidebar {
  display: -ms-grid;
  display: grid;
  -ms-grid-rows: 1fr 1fr;
  -ms-grid-columns: 1fr 2fr;
      grid-template:
    "nav       content" 1fr
    "subscribe content" 1fr /
     1fr       2fr;
}

.double-sidebar {
  display: -ms-grid;
  display: grid;
  -ms-grid-rows: 1fr 1fr;
  -ms-grid-columns: 1fr 2fr 1fr;
      grid-template:
    "nav    content   sidebar" 1fr
    "nav    subscribe sidebar" 1fr /
     1fr     2fr       1fr;
}

expected output CSS

.content {
  -ms-grid-row: 1;
  -ms-grid-row-span: 2;
  -ms-grid-column: 2;
  grid-area: content;
}
.double-sidebar > .content {
  -ms-grid-row: 1;
  -ms-grid-row-span: 1; /* <-- row span is output to override the other one */
  -ms-grid-column: 2;
}

.single-sidebar {
  display: -ms-grid;
  display: grid;
  -ms-grid-rows: 1fr 1fr;
  -ms-grid-columns: 1fr 2fr;
      grid-template:
    "nav       content" 1fr
    "subscribe content" 1fr /
     1fr       2fr;
}

.double-sidebar {
  display: -ms-grid;
  display: grid;
  -ms-grid-rows: 1fr 1fr;
  -ms-grid-columns: 1fr 2fr 1fr;
      grid-template:
    "nav    content   sidebar" 1fr
    "nav    subscribe sidebar" 1fr /
     1fr     2fr       1fr;
}

The logic around this should be that if a row span is required for any property that shares the same area name, all rules that share that area name need to be given a row span value. Same goes for column span.

The demo is actually a Codepen that I'm using in my article so this is another issue that is blocking the article from being published :(

@bogdan0083, can you take a look at this one?

@bogdan0083
Copy link
Contributor

I'll take a look at this one 👍

@ai
Copy link
Member

ai commented Oct 23, 2018

Released in 9.3

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

No branches or pull requests

3 participants