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

[Tabs] Remove duplicate styles #23561

Merged
merged 5 commits into from
Nov 26, 2020
Merged

[Tabs] Remove duplicate styles #23561

merged 5 commits into from
Nov 26, 2020

Conversation

cmfcmf
Copy link
Contributor

@cmfcmf cmfcmf commented Nov 15, 2020

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.

(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)

@mui-pr-bot
Copy link

mui-pr-bot commented Nov 15, 2020

Details of bundle changes

Generated by 🚫 dangerJS against 1891455

@oliviertassinari
Copy link
Member

Related to #15824 and #15324.

@oliviertassinari oliviertassinari added the component: tabs This is the name of the generic UI component, not the React module! label Nov 15, 2020
@mbrookes mbrookes added the bug 🐛 Something doesn't work label Nov 15, 2020
@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 15, 2020

What do you think about?

  • removing the min-width style
  • keeping the mobile & desktop padding at 24px

@oliviertassinari oliviertassinari changed the title [Tabs] Re-enable increased padding on big screens [Tabs] Update to match the Material Design specification Nov 15, 2020
Copy link
Member

@eps1lon eps1lon left a 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:

  1. 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
  2. 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

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 16, 2020

  1. small tab size but full width tablist = space used that is not needed

@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:

Capture d’écran 2020-11-16 à 18 25 54

The way Stripe, Ant Design, and the other handles it is cleaner:

Capture d’écran 2020-11-16 à 18 27 56

We could have a simple border-bottom style, using <Box sx={{ borderBottom: 1, borderColor: 'divider' }} />. It's used in some of the demos of https://material.io/components/tabs.

Capture d’écran 2020-11-16 à 18 35 16


  1. Individual tabs should use some min-width

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.

@eps1lon
Copy link
Member

eps1lon commented Nov 16, 2020

A min-width seems to would only impact the visual regression test, not the outcome in developers's app:

We support resizing the window in our demos do we not?

nav-resize

This screenshot would suggest we need a min-width, but the official implementation doesn't have one.

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.

small tab size but full width tablist = space used that is not needed

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-

@oliviertassinari
Copy link
Member

We support resizing the window in our demos do we not?

@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

Capture d’écran 2020-11-19 à 13 15 27

Tabs vertically resizing when I resize the page horizontally does not sound ok to me.

At least, it's not the default, it only happens because the tabs are set full-width, which is expected. By default, it scrolls :).

@eps1lon
Copy link
Member

eps1lon commented Nov 20, 2020

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.

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: codesandbox.io/s/ubt9g

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:

next--material-ui netlify app_components_tabs_

https://deploy-preview-23561--material-ui.netlify.app/components/tabs/#nav-tabs:
deploy-preview-23561--material-ui netlify app_components_tabs_

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 20, 2020

So do you agree that this is bad behavior or not? We shouldn't document problematic code.

@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.

I'm strictly speaking in the context of our docs (resized horizontally to minimum possible):

Does it come from the change of horionztal padding? In next, we have 12px and in PR 24px.

@oliviertassinari oliviertassinari changed the title [Tabs] Update to match the Material Design specification [Tabs] Remove duplicate styles Nov 24, 2020
@oliviertassinari oliviertassinari dismissed eps1lon’s stale review November 24, 2020 20:16

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

cmfcmf and others added 5 commits November 24, 2020 21:27
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 <cmfcmf.flach@gmail.com>
@oliviertassinari
Copy link
Member

For future pull requests, it seems that we could significantly improve the https://next.material-ui.com/components/tabs/ page:

  1. Use the Experimental API in all the pages, much better
  2. Update the demos to focus on desktop, the current app bar is overused. Have a few demos for mobile when it makes sense
  3. Update the styles to match the Material Design guidelines

cc @mbrookes

@oliviertassinari oliviertassinari removed the bug 🐛 Something doesn't work label Nov 24, 2020
@oliviertassinari oliviertassinari merged commit 49b173e into mui:next Nov 26, 2020
@oliviertassinari
Copy link
Member

@cmfcmf Thanks for raising the issue with the dead code :)

@cmfcmf cmfcmf deleted the patch-2 branch November 26, 2020 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tabs This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants