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

[material-ui][CssBaseline] Margin not being set to 0 on headers in Next.js #40443

Closed
vim-diesel opened this issue Jan 5, 2024 · 1 comment
Closed
Assignees
Labels
component: CssBaseline The React component nextjs package: material-ui Specific to @mui/material status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it

Comments

@vim-diesel
Copy link

vim-diesel commented Jan 5, 2024

Steps to reproduce

Link to live example: https://space-traders-orpin.vercel.app/

View code here:
vim-diesel/mui-issue-github-example3

Steps:

  1. Start a NextJS project using latest version, 14, and install MUI
  2. import { AppRouterCacheProvider } from '@mui/material-nextjs/v14-appRouter'; and wrap it around the {children} in layout
  3. Create a Provider client component and import { ThemeProvider, createTheme } from '@mui/material/styles'; and use it in the layout
  4. Import the CssBaseline into the Layout component so it is rendered alongside all {children}.
  5. Create a header and it will have a margin.

Current behavior

There is a margin applied to all headers.

Expected behavior

A proper CSS Reset should remove this.

Context

Open up the live example and remove the rule that applies a margin of 0 to all element and the margin gets appears. This should already be applied by a css reset.

Your environment

npx @mui/envinfo System:
OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)

Binaries:

Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v20.9.0/bin/yarn
npm: 10.2.3 - ~/.nvm/versions/node/v20.9.0/bin/npm

Browsers:

Chrome: Not Found

npmPackages:

@emotion/react: ^11.11.3 => 11.11.3
@emotion/styled: ^11.11.0 => 11.11.0
@mui/base:  5.0.0-beta.29
@mui/core-downloads-tracker:  5.15.2
@mui/material: ^5.15.2 => 5.15.2
@mui/material-nextjs: ^5.15.0 => 5.15.0
@mui/private-theming:  5.15.2
@mui/styled-engine:  5.15.2
@mui/system:  5.15.2
@mui/types:  7.2.11
@mui/utils:  5.15.2
@types/react:  18.2.46
react: ^18 => 18.2.0
react-dom: ^18 => 18.2.0
typescript:  5.3.3
  Don't forget to mention which browser you used. ===> Edge
  Output from `npx @mui/envinfo` goes here.

Search keywords: cssbaseline, css, margin, padding

@vim-diesel vim-diesel added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 5, 2024
@zannager zannager added component: CssBaseline The React component nextjs labels Jan 8, 2024
@danilo-leal danilo-leal changed the title CSSBaseline not setting margin to 0 on headers in NextJS [material-ui][CSS Baseline] Margin not being set to 0 on headers in Next.js Jan 9, 2024
@danilo-leal danilo-leal added the package: material-ui Specific to @mui/material label Jan 9, 2024
@oliviertassinari oliviertassinari changed the title [material-ui][CSS Baseline] Margin not being set to 0 on headers in Next.js [material-ui][CssBaseline] Margin not being set to 0 on headers in Next.js Jan 23, 2024
@mnajdova mnajdova assigned siriwatknp and unassigned mnajdova Jan 31, 2024
@siriwatknp
Copy link
Member

I could not see any margin applied. Feel free to reopen the issue with a screenshot or video that shows the issue.

@siriwatknp siriwatknp added status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: CssBaseline The React component nextjs package: material-ui Specific to @mui/material status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it
Projects
None yet
Development

No branches or pull requests

5 participants