mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.68k stars 32.22k forks source link

AccordionSummary first and last child's corners do not display as rounded #27418

Open datoslabs opened 3 years ago

datoslabs commented 3 years ago

When AccordionSummary is given an opaque background color, the first child's top-left/right and last child's bottom-left/right corners appear to be squared even though the MuiAccordion-rounded:first-child and MuiAccordion-rounded:last-child styles are correctly applied. This occurs because the AccordionSummary's corners are squared, stacking on top of the parent div (ie Accordion); when AccordionSummary's background color is transparent, this does not cause an issue but when its background color is opaque, the first and last Accordions' corners will appear as squared.

Current Behavior 😯

When AccordionSummary is given an opaque background color, the first child's top-left/right and last child's bottom-left/right corners appear to be squared instead of rounded.

Expected Behavior πŸ€”

Frist and last Accordion's corners should be rounded.

Steps to Reproduce πŸ•Ή

Steps:

  1. Open the Simple accordion example in codesandbox.io - https://codesandbox.io/s/ccmf9
  2. Note the first and last accordion's corners are rounded.
  3. Add style={{backgroundColor:'blue'}} to each of the AccordionSummary elements
  4. Corners are showing as squared.

Context πŸ”¦

Accordion display should be consistent and its first and last child's corner rounding should not be affected by the AccordionSmmary's color.

Your Environment 🌎

Material-ui Accordion demo example.

tancarlson commented 3 years ago

Process Completed image image image I have solved the problem but does not pass the CI...

tancarlson:scc-branch

tancarlson commented 3 years ago

Those are the problem encountered

eps1lon commented 3 years ago

Thanks for the feedback.

Frozen repro with v5: https://codesandbox.io/s/basicaccordion-material-demo-forked-l3u0y?file=/demo.tsx

We could fix this by adding style={{overflow:'hidden'}} to the parent Accordion or applying the same border-radius to the AccordionDetails and AccordionSummary.

Would be nice if somebody could explore both of these approaches and file a PR with what they think works best so that we can investigate.

kinshukshah commented 3 years ago

Hi @eps1lon I will take up the issue and create a PR.

kinshukshah commented 3 years ago

Hi @eps1lon I have created a Pull Request can you please go through it.

kinshukshah commented 3 years ago

These are the checks I am not able to pass can you help me image

Anurag-Band commented 4 days ago

while working with Accordion I came across this issue, How I solved it in my project is I put below styles in Parent of Accordion,

"& .MuiPaper-root:first-of-type": { borderRadius: "12px !important", }, "& .MuiPaper-root:last-of-type": { borderRadius: "12px !important", }

image