It’s like when my daughter Maya is trying to draw something big on a small piece of paper, but she needs the whole table to really spread out. The widget-card needs that full table to do its thing.
Spot the Bug answer: The .widget-card element is not a direct child of the .dashboard grid container, preventing it from inheriting the subgrid columns.
The fix:
Add display: contents; to the .widget-card element.
Why:
For subgrid to work, the element with grid-template-columns: subgrid must be a direct child of the grid container whose tracks it intends to inherit. In this case, .widget-card is not a direct child of .dashboard. By adding display: contents to .widget-card, it effectively removes the box of the element itself, making its children direct children of the .dashboard grid for layout purposes, allowing subgrid to function correctly.
Nobody got this one. It was a sneaky one.
Close but not quite:
@kirupa - The user misunderstood the relationship between the parent grid’s columns and the subgrid’s span, focusing on the span of the widget-card itself rather than the subgrid inheritance issue.
okay so this is exactly why I always tell people to visualize the box model. if you don’t see that intermediate box, you’ll never guess display: contents.
I’ve seen similar issues where a dashboard component’s state isn’t properly reset on re-render. That’s usually a fun one to track down when it only happens sometimes.