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

[docs] Fix TOC-related styles not being applied when disableAd=true #32733

Merged
merged 1 commit into from
May 11, 2022

Conversation

cherniavskii
Copy link
Member

@cherniavskii cherniavskii commented May 11, 2022

In MUI X I've noticed that some pages have horizontal scroll on smaller screens, for example:
https://mui.com/x/react-data-grid/state/

Screen.Recording.2022-05-11.at.11.43.40.mov

I've tracked this down to this:

...(!disableAd && {
'&& .description': {
marginBottom: 198,
},
'&& .description.ad': {
marginBottom: 40,
},
...(!disableToc && {
[theme.breakpoints.up('sm')]: {
width: `calc(100% - var(--MuiDocs-toc-width))`,
},
}),
...(!disableToc && {
[theme.breakpoints.up('lg')]: {
paddingLeft: '60px',
paddingRight: '60px',
},
}),
}),

Here you can see that !disableToc styles are nested inside !disableAd styles, so they are not applied unless disableAd=false. The page in MUI X I've linked above has disableAd=true, and missing TOC-related style cause horizontal scroll.
This seems to be a regression from bf225c3 (#27150)

TOC-related styles should be applied regardless disableAd prop, so I've moved them one level up.

In core repo I've found only one page affected by this issue - https://mui.com/material-ui/discover-more/backers/.

Screenshot 2022-05-11 at 11 53 23

Same page with the fix: https://deploy-preview-32733--material-ui.netlify.app/material-ui/discover-more/backers/.

@mui-bot
Copy link

mui-bot commented May 11, 2022

No bundle size changes

Generated by 🚫 dangerJS against 269d82b

@cherniavskii
Copy link
Member Author

cherniavskii commented May 11, 2022

Side note: It's still an open question if disableAd should be used on those pages in MUI X, but the root cause should be fixed anyway

UPDATE: we disable ads on all pages with paid features (Pro and Premium plans)

@cherniavskii cherniavskii requested a review from a team May 11, 2022 10:17
@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation label May 11, 2022
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

Great, I had this one on my to-do list of small wins with high ROI. I noticed the problem with this page: https://mui.com/x/react-data-grid/state/.

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

👍

@cherniavskii cherniavskii merged commit 673cb59 into mui:master May 11, 2022
@cherniavskii cherniavskii deleted the fix-docs-layout-with-toc branch May 11, 2022 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants