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

[Grid] CSS grid support #9513

Open
tanekim88 opened this issue Dec 15, 2017 · 27 comments
Open

[Grid] CSS grid support #9513

tanekim88 opened this issue Dec 15, 2017 · 27 comments
Labels
component: Grid The React component. new feature New feature or request waiting for 👍 Waiting for upvotes

Comments

@tanekim88
Copy link

tanekim88 commented Dec 15, 2017

CSS-Grid is now newer and better grid system than flexbox, but they can be used together. Please see the link:
https://css-tricks.com/snippets/css/complete-guide-grid/
And it's now supported by most browsers, and it's matter of time it will become the standard way of defining the grid layout.
Would Material UI implement CSS Grid as well for incoming updates?

Problems it could solve

  • Remove the need for negative paddings.
  • Works better for page layouts when the HTML is streamed in chunks which creates layout shifts

Benchmark

@oliviertassinari oliviertassinari added the new feature New feature or request label Dec 15, 2017
@oliviertassinari
Copy link
Member

oliviertassinari commented Dec 15, 2017

Would Material UI implement CSS Grid as well for incoming updates?

@tanekim77 I think that we should dive deeper into the potential of using CSS Grid. What can we improve?

EDIT:

The system allows using the CSS Grid properties with the sx prop and flattens props:

@nabrach
Copy link

nabrach commented Dec 21, 2017

I think CSS Grid is easy enough to implement on it's own. No need to include it as a part of Material UI.

@mbrookes
Copy link
Member

mbrookes commented Dec 21, 2017

Our Grid component will need to continue to use flexbox for the forseeable. Only 76% of browsers in use globally support grid. I'd suggest we mark "wontfix", and revisit in a few years time.

@oliviertassinari

This comment has been minimized.

@mbrookes
Copy link
Member

@oliviertassinari flexbox is working just fine forGrid, and has relatively broad browser support. Since we can't yet replace flexbox with grid, to use grid would mean introducing a second grid system in parallel with Grid. That doesn't seem like a good use of time.

@oliviertassinari

This comment has been minimized.

@mbrookes

This comment has been minimized.

@oliviertassinari oliviertassinari added waiting for 👍 Waiting for upvotes discussion and removed new feature New feature or request waiting for 👍 Waiting for upvotes labels Dec 22, 2017
@oliviertassinari

This comment has been minimized.

@oliviertassinari
Copy link
Member

I have added the waiting for users upvotes tag. I'm closing the issue as I'm not sure people are looking for such abstraction. So please upvote this issue if you are. We will prioritize our effort based on the number of upvotes.

@oliviertassinari oliviertassinari added new feature New feature or request waiting for 👍 Waiting for upvotes and removed discussion labels Dec 22, 2017
@mbrookes
Copy link
Member

mbrookes commented Dec 22, 2017

@oliviertassinari CSS grid is the "right" way to implement a grid system, with flexbox being more appropriate for component-level layout. I've been around long enough to remember pre-table layout challenges, and the abuse of table for layout,so it is exciting that we finally have an appropriate solution (hard to believe it's taken this long!).

However, just as it took many years before flexbox stabilised and reached critical mass in terms of browser support, it will be a few years before grid is widely supported. For example, I have a 3rd gen iPad that is perfecty functional, but no loger recieves updates. It will sadly never support grid. Thanks Apple! (Also have a 1st gen iPad, but that's more of a museum piece, so fair enough!)

It's right to consider when to support CSS grid, but we have to be pragmatic about the practicality of using it (given relatively limited broswer support), when flexbox is serving us well for now.

@evdama

This comment has been minimized.

@mbrookes
Copy link
Member

Not yet:

Global: 85.36% + 2.93% = 88.3%
unprefixed: 85.36%

https://caniuse.com/#feat=css-grid

@dmwyatt
Copy link
Contributor

dmwyatt commented Apr 24, 2019

At which percentage of browser support will it be considered the norm? It's at 90% now.

Also, I wanted to point out that the docs site is a little confusing on this issue.

In the middle of the page discussing MUI's grid, there's this big heading and paragraph talking about CSS grid. I think the point is that you can also use CSS Grid, but MUI does not provide any sort of abstraction over it, but this is not explicitly stated anywhere and it seems like a discombobulating location to put this info even if it is explicitly stated.

@oliviertassinari
Copy link
Member

oliviertassinari commented Apr 24, 2019

At which percentage of browser support will it be considered the norm?

@dmwyatt The question to ask is whether the browsers we officially support have the feature or not. Chrome 49 support seems to be the only bottleneck. Also, please consider that Google Bot uses Chrome 41 for rendering your page. Anyway, we might be able to use CSS Grid internally.

I wanted to point out that the docs site is a little confusing on this issue.

I agree, do you want to clarify this documentation section? :)

How do you think that we could leverage the CSS Grid?

@dmwyatt

This comment has been minimized.

dmwyatt added a commit to dmwyatt/material-ui that referenced this issue Apr 24, 2019
As discussed in mui#9513 starting at mui#9513 (comment) the current documentation was a little confusing and not really located in a logical place.

I'm not sure there *is* a logical place for this information, but it seems like the end of the document is better than in the middle of information talking about grid stuff that MUI *does* support.

I made the fact that Material UI doesn't provide any CSS Grid functionality explicit.

I also took out the warning about CSS Grid only being supported in the latest browsers.  As of right now it has 90% browser coverage at https://caniuse.com/#feat=css-grid.
oliviertassinari pushed a commit that referenced this issue Apr 25, 2019
* Better (?) CSS Grid documentation

As discussed in #9513 starting at #9513 (comment) the current documentation was a little confusing and not really located in a logical place.

I'm not sure there *is* a logical place for this information, but it seems like the end of the document is better than in the middle of information talking about grid stuff that MUI *does* support.

I made the fact that Material UI doesn't provide any CSS Grid functionality explicit.

I also took out the warning about CSS Grid only being supported in the latest browsers.  As of right now it has 90% browser coverage at https://caniuse.com/#feat=css-grid.

* Update grid.md
@goszczynskip
Copy link

@oliviertassinari Google recently announced that their bot was updated to evergreen: link.

@oliviertassinari

This comment has been minimized.

@oliviertassinari

This comment has been minimized.

@oliviertassinari oliviertassinari added the priority: important This change can make a difference label Nov 7, 2019
@oliviertassinari oliviertassinari removed waiting for 👍 Waiting for upvotes priority: important This change can make a difference labels Nov 30, 2019
@oliviertassinari oliviertassinari changed the title CSS Grid Support? [Grid] CSS grid support Dec 1, 2019
@oliviertassinari oliviertassinari added the component: Grid The React component. label Dec 1, 2019
@numToStr

This comment has been minimized.

@ghost

This comment has been minimized.

@ghost
Copy link

ghost commented Nov 18, 2020

2020-11-18: 96.09%

https://caniuse.com/css-grid

image

@oliviertassinari

This comment has been minimized.

@oliviertassinari

This comment has been minimized.

@jrhager84

This comment has been minimized.

@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 22, 2021

@jrhager84 Not sure yet. At least, we have a clean new demo for it: https://next.material-ui.com/components/grid/#css-grid-layout

Screenshot 2021-03-22 at 02 18 26

and https://next.material-ui.com/system/grid/

@ghost

This comment has been minimized.

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 29, 2021

Regarding the next step on this issue, we have a couple of options:

  1. We do nothing, per [Grid] CSS grid support #9513 (comment)
  2. We change the underlying implementation of the Grid with CSS Grid. There are currently no open issues about problems that such a move would fix. As far as I can push the reflection, it could be about being "cleaner" e.g. if your component is named Grid, you might expect it to use CSS Grid.
  3. We rename the Grid component to Flex for v6, and we implement a new Grid component using CSS Grid, maybe adding new system helper props.
  4. Or else?

I personally suspect that a great path could be to:

  • do some of 3 with CSS Grid helpers in the system (e.g. for rowSpan and columnSpan). It seems to be low-hanging fruit to simplify the DX with new shorthands.
  • maybe rename the current Grid to Flex for clarity and add a new Grid component with the same API. Bootstrap provides the two options: https://getbootstrap.com/docs/5.1/layout/css-grid/.

I think that we can wait for feedback from the developers, to better understand the space of the pain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Grid The React component. new feature New feature or request waiting for 👍 Waiting for upvotes
Projects
None yet
Development

No branches or pull requests

9 participants