question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[css-grid] Report a warning if duplicate area names are detected

See original GitHub issue

Take this css:

.grid-alpha {
  grid-template-areas: "delta  echo";
}

.grid-beta {
  grid-template-areas: "echo  delta";
}

.grid-cell {
  -ms-grid-column: ???; /* what column does .grid-cell go in? */
  arid-area: echo;
}

Autoprefixer has no access to the DOM so it doesn’t really know what area .grid-cell belongs to.

Currently Autoprefixer silently just goes with whatever the last grid-template-areas definition was in the style-sheet (in this case "echo delta"). If a user places .grid-cell in .grid-alpha then it will look great in modern browsers but be placed in the wrong column in IE.

Since it is silent, a user could end up building their whole site blissfully unaware of this issue, using duplicate area names everywhere, then finally open IE to see their whole layout go to shit.

Autoprefixer should detect if there are any area name conflicts and if so, warn users to use unique area names at all times.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
Dan503commented, Aug 4, 2018

@ai I’ve removed the references to this issue in the CSS Tricks article since it has been fixed now.

1reaction
jdalegonzalezcommented, Aug 3, 2018

Forgive me if I’m missing something but isn’t this:

grid-template-areas:
    "Header           Header   Header"
    "TableOfContents  Tabs     Sidebar"
    "TableOfContents  Main     Sidebar"
    "Footer           Footer   Footer";

the way you’re supposed to describe a grid with what amounts to rowSpan and colSpan sections? Something like…

+===============================+
|           Header              |
+=======+==============+========+
|       |     Tabs     |        |
|       +==============+        |
|       |              |        |
| TOC   |              |  Side  |
|       |     Main     |        |
|       |              |        |
|       |              |        |
+=======+==============+========+
|           Footer              |
+===============================+

Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-areas

Are you saying that while it’s legal, it isn’t supported by IE? It seems like a problem that legal CSS generates a warning. Is there a better way to accomplish the layout and still get autoprefixer support?

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Grid in IE: Duplicate area names now supported!
In Part 2 of the series, I pointed out why Autoprefixer wasn't able to handle duplicate area names that were used across multiple...
Read more >
netbeans 8.2 css grid warnings and errors - Stack Overflow
This question is closely related to another on SO, but it is not a duplicate: Netbeans CSS not hinting all properties.
Read more >
CSS Grid Layout and progressive enhancement
In this guide we will walk through a variety of strategies for support. The supporting browsers. Other than in Internet Explorer, CSS Grid...
Read more >
ANDI - Alerts
When ANDI is launched, it automatically analyzes every HTML element currently on the page looking for conditions that cause accessibility issues.
Read more >
redcap-faq.pdf - UT Southwestern
If the project combines a survey and data entry forms, the survey must be the first instrument so that new records are initiated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found