• Stars
    star
    1,185
  • Rank 39,473 (Top 0.8 %)
  • Language
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A curated list of Grid interop issues

GridBugs

Inspired by Flexbugs this list aims to be a community curated list of CSS Grid Layout bugs, incomplete implementations and interop issues. Grid shipped into browsers in a highly interoperable state, however there are a few issues - let's document any we find here.

While I'd like to focus on issues relating to the Grid Specification here, it is likely that related specs such as Box Alignment will need to be referenced. If you think you have spotted an issue and it seems to relate to Grid, post it. We can work out the details together and make sure browser or spec issues get logged in the right place.

Also, please raise an issue if I am wrong about any of these or you have more info or examples to add. Quite possibly I've pointed the finger at the wrong UA or missed a change in the spec. Help to make the list accurate appreciated!

This is not CSS Grid technical support

Please raise issues about interop issues where you have already been through the process of creating a Reduced Test Case to check that the issue isn't something in your code. If you want to learn about CSS Grid Layout then check out Grid by Example where I have video tutorials, small examples and links to other resources. I will answer more general grid questions on my AMA when time allows. I also have information regarding fallbacks for older browsers.

The bugs

  1. grid-auto-rows and grid-auto-columns should accept a track listing
  2. Repeat notation should accept a track listing
  3. Fragmentation support
  4. Sizing of items with an intrinsic size inside fixed size grid tracks
  5. Items with an intrinsic aspect ratio should align start
  6. The grid-gap property should accept percentage values
  7. Grid gaps should behave as auto-sized tracks?
  8. Setting max-height to a percentage should scale down a larger image inside a grid track
  9. min-content and max-content in track listings
  10. Some HTML elements can't be grid containers
  11. A textarea that is a grid item collapses to zero width
  12. Space distributed to empty tracks spanned by an item with content
  13. Inconsistency with percentage padding and margins
  14. fit-content is stretching

1. grid-auto-rows and grid-auto-columns should accept a track listing

Demos Browsers affected Tracking bugs Tests
1.1 β€” bug Firefox Firefox #1339672 WPT

The properties grid-auto-rows and grid-auto-columns enable an author to set the size of tracks created in the implicit grid. The spec says:

"If multiple track sizes are given, the pattern is repeated as necessary to find the size of the implicit tracks. The first implicit grid track before the explicit grid receives the first specified size, and so on forwards; and the last implicit grid track before the explicit grid receives the last specified size, and so on backwards." - 7.6 Implicit Track Sizing

2. Repeat notation should accept a track listing

Demos Browsers affected Tracking bugs
2.1 β€” bug Firefox Firefox #1341507

Repeat notation can accept a single track sizing to repeat, eg:

repeat(3,200px);

Or a track listing:

repeat(3, 200px 100px);

This includes when the number of repeats is auto-fill or auto-fit to create as many tracks as will fit.

"The first argument specifies the number of repetitions. The second argument is a track list, which is repeated that number of times." - Syntac of repeat()

3. Fragmentation Support

Demos Browsers affected Tracking bugs
Firefox
Chrome
Safari
Firefox #1266265
Chrome #614667

There is limited fragmentation support across browsers at present, therefore features such as the break-* properties are unlikely to work reliably. For details of how fragmentation should work in Grid Layout see 12. Fragmenting Grid Layout.

4. Sizing of items with an intrinsic size inside fixed size tracks

Demos Browsers affected Tracking bugs
4.1 β€” bug Firefox Firefox #1385410

In Firefox images with an intrinsic size are scaling down to fit into a fixed size grid track, rather than overflowing.

I believe that the correct behavior is to overflow, as per the CSS WG resolution of Issue 523.

5. Items with an intrinsic aspect ratio should align start

Demos Browsers affected Tracking bugs
5.1 β€” bug
5.2 β€” workaround
Safari 10 (fixed in Technical Preview)

In Safari 10, a grid item that has an intrinsic aspect ratio was defaulting to stretch, rather than start.

Workaround

The workaround for this is to declare align-self: start and justify-self: start on the item.

6. The grid-gap property should accept percentage values

Demos Browsers affected Tracking bugs
6.1 β€” bug Safari 10 (fixed in Technical Preview 29) WebKit #170764

Currently percentage values of grid-gap are marked as at-risk in the Level 1 specification. A strong use case for percentage values is that of adding some grid layout features to a layout which already uses a float, or flexbox-based grid system see tweet from @minamarkham. These systems have to use percentages for spacing in order to create a 'grid'.

7. Grid gaps should behave as auto-sized tracks?

There is also an interop issue with regard to percentage grid-row-gap values, where the height of the grid is not a fixed size. Chrome and Safari TP, plus Edge Preview collapse the row gap to 0. Firefox is using a percentage of the total height, I think.

8. Setting max-height to a percentage should scale down a larger image inside a grid track

Demos Browsers affected Tracking bugs
8.1 β€” bug Chrome Chromium #750631

Using max-height on an image inside a fixed size track should resolve so that the image scales down to fit inside the track. Currently in Chrome this does not work and so the image overflows. Using max-width works when the image is constrained by the column track sizing, setting a fixed height works as expected as does setting a max-height using a length unit such as px.

9. min-content and max-content in track listings

Demos Browsers affected Tracking bugs
9.1 β€” bug Safari 10 (fixed in Technology Preview) WebKit #169195

In Safari 10, the values min-content, max-content and fit-content were prefixed. These have now been unprefixed in Safari Technology Preview.

Workaround

The workaround for this is to use the prefixed -webkit-min-content, -webkit-max-content and -webkit-fit-content.

10. Some HTML elements can't be grid containers

Demos Browsers affected Tracking bugs
10.1 β€” bug (fieldset)
10.2 β€” bug (button)
Chrome
Safari 10 (fieldset fixed in Technology Preview)
Chromium #375693

In Chrome (and Safari 10) fieldset elements with display: grid do not act as grid containers. The button element only functions as a grid container in Firefox. This is related to the same issue in Flexbox, detailed on the Flexbugs site.

11. A textarea that is a grid item collapses to zero width

Demos Browsers affected Tracking bugs
11.1 β€” bug Chrome (on OSX only) Chromium #727076

On OS X Chrome, if a textarea is a grid item it collapses to 0 width when text is typed into it. Linked to test case from the Chromium issue as due to the way CodePen loads into an iframe this doesn't seem to happen there.

12. Space distributed to empty tracks spanned by an item with content

Demos Browsers affected Tracking bugs
12.1 β€” bug 1
12.2 β€” bug 2
Firefox Firefox #1386921
Firefox #1386932

If you have a grid with empty tracks which are spanned by an item on the grid, those tracks should not be assigned extra space due to the spanning item. Firefox is assigning extra space (bug 1), related is the fact that Firefox does different things depending on source order (bug 2).

Thanks to everyone who helped to isolate these issues here. The discussion is useful if you want to understand exactly what is going on.

13. Inconsistency with percentage padding and margins

Demos Browsers affected Tracking bugs
13.1 β€” bug Firefox & Edge match
Chrome & Webkit match
Chrome #229568

As detailed by @mrego there is a longstanding interoperability issue with percentage padding and margins in both Grid and Flexbox.

Firefox and Edge (Preview) resolve the percentage margins/paddings on items against their respective dimension (width or height), Chrome always uses width, in the same way that percentages are resolved in block layout. The specification allows for both possibilities, and suggests authors do not use percentage margins and padding.

14. fit-content is stretching

Demos Browsers affected Tracking bugs Tests
14.1 β€” bug Chrome
Webkit
Chrome #755994
CSS Spec issue #1732
WPT

Report by @simevidas Chrome is stretched tracks sized with fit-content where Firefox does not. Edge (Preview) matches the behaviour in Firefox.

It turned out this is less straightforward than first appeared. See the discussion on the issue raised against the CSS spec. During the telecon on September 20, 2017 the CSS WG resolved that tracks should not stretch, making the Firefox/Edge behaviour correct. The next day a patch was submitted to Blink to fix the issue in Chrome.

Workaround

The workaround for this is to use justify-content: start or justify-content: end on the tracks.

Acknowledgments

Gridbugs is maintained by @rachelandrew and was heavily inspired by the excellent Flexbugs.

Contributing

In the first instance raise an Issue, include a Reduced Test Case that demonstrates the problem clearly. If you are aware of a workaround for the problem, add that too.