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 code copy button obscuring on small screen sizes #44861

Merged

Conversation

ZeeshanTamboli
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli commented Dec 26, 2024

Part of #43863, addressing point one.

The button can simply be hidden on smaller screens like for mobile. I considered 640px.

@ZeeshanTamboli ZeeshanTamboli added bug 🐛 Something doesn't work scope: docs-infra Specific to the docs-infra product labels Dec 26, 2024
@mui-bot
Copy link

mui-bot commented Dec 26, 2024

Netlify deploy preview

https://deploy-preview-44861--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 616f018

@ZeeshanTamboli ZeeshanTamboli requested a review from a team December 26, 2024 07:29
@ZeeshanTamboli
Copy link
Member Author

@alexfauquette Could you review this?

@ZeeshanTamboli ZeeshanTamboli merged commit 485f81c into mui:master Jan 8, 2025
19 checks passed
@ZeeshanTamboli ZeeshanTamboli deleted the fix-code-button-in-docs-obscuring branch January 8, 2025 10:01
@@ -559,6 +559,9 @@ const Root = styled('div')(
transition: theme.transitions.create(['background', 'borderColor', 'display'], {
duration: theme.transitions.duration.shortest,
}),
'@media (max-width: 640px)': {
Copy link
Member

@oliviertassinari oliviertassinari Jan 8, 2025

Choose a reason for hiding this comment

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

Why does it use a custom value? Meaning, why is this not using the theme breakpoints? I think deviations from the standard deserve code comments.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 8, 2025

Is this solving the problem? For example:

SCR-20250108-nirn

https://deploy-preview-44861--material-ui.netlify.app/material-ui/integrations/nextjs/#typescript

Now, I guess it will always be a problem. If we have a toolbar, rendering the copy button there seems better, e.g. https://deploy-preview-44861--material-ui.netlify.app/material-ui/integrations/nextjs/#font-optimization-2

SCR-20250108-nfax

This works too for the code install block SCR-20250108-nfsl

@alexfauquette
Copy link
Member

For sure it's not perfect, but it's a step in the right direction. At least now people landing on the installation page will not see this button hiding a big part of the command line.

image

It prevent the button from bother mobile users, but does not solves issue for desktop users

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 10, 2025

Base UI solved this problem by relying more on the header, e.g. https://base-ui.com/react/handbook/composition#composing-custom-react-components

SCR-20250111-bvns

It's not ideal though, it's bulky to show that header when it has little use cases.

It prevent the button from bother mobile users, but does not solves issue for desktop users

The problem we might have though now is: https://en.wikipedia.org/wiki/Region-beta_paradox 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work scope: docs-infra Specific to the docs-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants