-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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] Better document direction column limitation #18225
Comments
@cyrfer As far as I remember, the xs, sm, etc. props don't work with the vertical direction. This issue remembers me of an older one but I can't find it. Do you actually need direction vertical here? |
@oliviertassinari in fact they cause unexpected results. You clicked the codesandbox link, right? Yes, frequently I prefer block elements stack in the vertical direction, like most simple websites. Changing to |
@cyrfer I could find the documentation for this problem: https://material-ui.com/components/grid/#direction-column-column-reverse. We should probably be able to make this section more direct, clearer and shorter. |
What about? diff --git a/docs/src/pages/components/grid/grid.md b/docs/src/pages/components/grid/grid.md
index 465149ea0..01636e70d 100644
--- a/docs/src/pages/components/grid/grid.md
+++ b/docs/src/pages/components/grid/grid.md
@@ -119,12 +119,10 @@ In practice, you can set the `zeroMinWidth` property:
### direction: column | column-reverse
-Though the `Grid` component has a `direction` property that allows values of `row`, `row-reverse`, `column`, and `column-reverse`,
-there are some features that are not supported within `column` and `column-reverse` containers.
-The properties which define the number of grids the component will use for a given breakpoint
-(`xs`, `sm`, `md`, `lg`, and `xl`) are focused on controlling width
-and do **not** have similar effects on height within `column` and `column-reverse` containers.
-If used within `column` or `column-reverse` containers, these properties may have undesirable effects on the width of the `Grid` elements.
+The xs, sm, md, lg, and xl props are **not supported** within `direction="column"` and `direction="column-reverse"` containers.
+
+They define the number of grids the component will use for a given breakpoint (focused on controlling width).
+If used, these props may have undesirable effects on the width of the `Grid` item elements.
|
Doc improvements are always appreciated. I think you adequately described the issue now. Supporting expected behavior seems straight forward to me. I hope we can consider that path also. |
@oliviertassinari actually, what do you think about changing,
to:
|
@cyrfer This sounds good 👍. Do you want to give it a try? |
@oliviertassinari great! Yes! Any chance you could point me in the right direction? I'm thinking I need to check when the parent is a column container and make a selector that prefers |
@cyrfer I meant, for an update of the documentation, not the implementation. |
@oliviertassinari who can I talk to about fixing the bug? |
@cyrfer At this point, I doubt we can change the Grid component implementation (I suspect we can only add new features), I would fear that a change like this could break people layouts. |
@oliviertassinari your hesitation is warranted. When I think about it, I cannot imagine who would be depending on a column layout that expresses height using width props. The result does not seem easy to plan around. However, perhaps someone has decided to do that. Is it possible to control feature flags, perhaps using theme properties? That way developers can "opt into" the better behavior? |
@cyrfer Did you find a way to work around the problem? |
I feel like my original post was not absorbed. |
I would be interested in seeing a proof of concept. |
@joshwooding I think it would simply look like the codesandbox link. |
Hi @cyrfer
Well, I do! I don't know if I should or if it's a complete misunderstanding of the doc, but I find it very handy in some situations. I don't find where the doc specifies
I use it in vertical container in some of my custom components, and I just had a minor issue with the |
@cyrfer In fact, I don't see why you use a column container. What is your need of using it? I may be completely wrong though. What do you think @oliviertassinari ? |
@oliviertassinari |
Is there any update on this? |
@sprietNathanael I think that we should improve the documentation around how this is not a supported feature: #18225 (comment). What diff do you have in mind? |
@oliviertassinari Well, as I said earlier, I think it would be really great to support using |
@sprietNathanael What would the implementation look like? |
Well, I read again some of the comments here and there, and I found again a solution I've used to workaround this issue : #13277 (comment)
This works, but I have to re-implement this css for every component that nedd it. I could use my global theming to do it, but I think it would be really handy to have it implemented internaly in the library. Moreover, it only bypass |
@sprietNathanael Do you want to send a pull request? |
Grid items are an opinionated height when using the
xs
and similar attributes on items within Grid column containers.I don't think you should use
flex-basis
for Grid item's in a column container whenxs
and similar attributes are used on items. I thinkxs
and related attributes are intended to control the width only, never the height, but flex-basis controls height in column containers.Current Behavior 😯
The following code results in an item with
flex-basis: 100%
, which is not expected for column containers.Expected Behavior 🤔
Instead, I think height should not be controlled by
xs
and similar attributes on Grid items. You probably should usewidth: 100%
rather than flex-basis when an item is directly under a column container.The workaround I am using is to specify the width without the attributes, e.g.
Steps to Reproduce 🕹
https://codesandbox.io/s/mui-bug-for-column-containers-8ztdx
Steps:
Context 🔦
I'm trying to make a simple page with items going down on the page.
Your Environment 🌎
The text was updated successfully, but these errors were encountered: