-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Tabs] Remove duplicate styles #23561
Conversation
What do you think about?
|
76c4501
to
136f8d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The demos now look off:
- small tab size but full width tablist = space used that is not needed
e.g. https://deploy-preview-23561--material-ui.netlify.app/components/tabs/#basic-tabs - Individual tabs should use some min-width
Otherwise they wrap on smaller tablist sizes. You can reproduce this in the visual regression test (https://www.argos-ci.com/mui-org/material-ui/builds/5415 docs-components-tabs/NavTabs.png) or by resizing the window in the docs
@eps1lon Are you suggesting that we rework the demos? I like the idea! I think that they are too much mobile-driven. Google Cloud seems to better leverage them: The way Stripe, Ant Design, and the other handles it is cleaner: We could have a simple border-bottom style, using
The demo impacted is https://deploy-preview-23561--material-ui.netlify.app/components/tabs/#nav-tabs. A min-width seems to would only impact the visual regression test, not the outcome in developers's app: https://codesandbox.io/s/navtabs-material-demo-forked-e3s0l?file=/demo.js. I think we are good on this end. This screenshot would suggest we need a min-width, but the official implementation doesn't have one. |
We support resizing the window in our demos do we not?
Ok? Sounds like you're suggesting our components should not accept CSS properties that aren't used in the official implementation. Tabs vertically resizing when I resize the page horizontally does not sound ok to me. Not having min-width by default is understandable since it's almost always either too much or too little. In the end the Tabs should not change dimensions in the y-axis on resize.
Retracting it for now. Personally, I would always add a visual separator for tabs so that it's obvious where they end and what "dead space" is. But that's out-of-scope for this PR- |
@eps1lon Did you try with a min-width? I see no impacts. Proof: open the demo, from the master branch, with the min-width in a code sandbox and resize it: https://codesandbox.io/s/ubt9g
At least, it's not the default, it only happens because the tabs are set full-width, which is expected. By default, it scrolls :). |
So do you agree that this is bad behavior or not? We shouldn't document problematic code.
I'm strictly speaking in the context of our docs (resized horizontally to minimum possible): https://next--material-ui.netlify.app/components/tabs/#nav-tabs: https://deploy-preview-23561--material-ui.netlify.app/components/tabs/#nav-tabs: |
@eps1lon Yes and no. In full-width mode, the Material Design guidelines ask to wrap the text if there isn't enough space. https://material.io/components/tabs#anatomy, https://material.io/archive/guidelines/components/tabs.html#tabs-content. I think that behavior is fundamentally correct. However, I also think that we should avoid text wrapping as much as possible for the demos. For instance, we could use shorter labels, as done in the guidelines, or reduce the padding.
Does it come from the change of horionztal padding? In next, we have 12px and in PR 24px. |
I have reduced the ambition of the pull request, it removes the dead code now, and improve the tests to avoid relying on implicit sizes
It looks like the first `[theme.breakpoints.up('sm')]` was being overwritten by the second `theme.breakpoints.up('sm')`, therefore the intended increased padding on `sm` and bigger screens did not take effect.
Co-authored-by: Christian Flach <[email protected]>
a330177
to
1891455
Compare
For future pull requests, it seems that we could significantly improve the https://next.material-ui.com/components/tabs/ page:
cc @mbrookes |
@cmfcmf Thanks for raising the issue with the dead code :) |
It looks like the first
[theme.breakpoints.up('sm')]
was being overwritten by the secondtheme.breakpoints.up('sm')
, therefore the intended increased padding onsm
and bigger screens did not take effect.(Note that I am not sure whether we actually want the padding or whether the Material Design spec has changed over the years and the padding should be different. However, the current state is clearly a bug)