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] Update min & max width and remove minWidth media query #26458

Merged
merged 4 commits into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/pages/components/tabs/TabsWrappedLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function TabsWrappedLabel() {
>
<Tab
value="one"
label="New Arrivals in the Longest Text of Nonfiction"
label="New Arrivals in the Longest Text of Nonfiction that should appear in the next line"
wrapped
/>
<Tab value="two" label="Item Two" />
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/tabs/TabsWrappedLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function TabsWrappedLabel() {
>
<Tab
value="one"
label="New Arrivals in the Longest Text of Nonfiction"
label="New Arrivals in the Longest Text of Nonfiction that should appear in the next line"
wrapped
/>
<Tab value="two" label="Item Two" />
Expand Down
3 changes: 3 additions & 0 deletions docs/src/pages/guides/migration-v4/migration-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,9 @@ You can use the [`collapse-rename-collapsedheight` codemod](https://github.com/m
+<Tabs scrollButtons={false} />
```

- Tab `minWidth` changed from `72px` => `90px` (without media-query) according to [material-design spec](https://material.io/components/tabs#specs)
- Tab `maxWidth` changed from `264px` => `360px` according to [material-design spec](https://material.io/components/tabs#specs)

### TextField

- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design Guidelines.
Expand Down
11 changes: 5 additions & 6 deletions packages/material-ui/src/Tab/Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,21 @@ const TabRoot = experimentalStyled(ButtonBase, {
})(({ theme, styleProps }) => ({
/* Styles applied to the root element. */
...theme.typography.button,
maxWidth: 264,
minWidth: 72,
maxWidth: 360,
minWidth: 90,
position: 'relative',
minHeight: 48,
flexShrink: 0,
padding: '6px 12px',
padding: '12px 16px',
siriwatknp marked this conversation as resolved.
Show resolved Hide resolved
overflow: 'hidden',
whiteSpace: 'normal',
textAlign: 'center',
[theme.breakpoints.up('sm')]: {
minWidth: 160,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change actually makes the minWidth smaller on up-sm. From 160px to 90px. Please add more detail on the migration page thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback to old behavior:

        MuiTab: {
            styleOverrides: {
                root: {
                    // up-sm
                    '@media screen and (min-width: 600px)': {
                        minWidth: 160,
                    },
                },
            },
        },

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The described outcome is expected. I guess we can clarify https://next.material-ui.com/guides/migration-v4/#tab

},
/* Styles applied to the root element if both `icon` and `label` are provided. */
...(styleProps.icon &&
styleProps.label && {
minHeight: 72,
paddingTop: 9,
paddingBottom: 9,
[`& .${tabClasses.wrapper} > *:first-child`]: {
marginBottom: 6,
},
Expand Down Expand Up @@ -122,6 +120,7 @@ const TabWrapper = experimentalStyled('span', {
justifyContent: 'center',
width: '100%',
flexDirection: 'column',
lineHeight: 1.25,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current wrapper inherit line-height: 1.75 which ~24px make 2 lines looks wierd. using 1.25 make it looks closer to the spec.

});

const Tab = React.forwardRef(function Tab(inProps, ref) {
Expand Down