mui / mui/material-ui

[material-ui][Accordion] First/Last of type styles do not work with other components as siblings

Open
#40,272 2 comments 0 reactions 1 assignee View on GitHub

@siriwatknp is already working on this.

Since Dec 22, 2023.

has workaround scope: accordion type: bug
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Steps to reproduce 🕹

Link to live example: https://codesandbox.io/p/sandbox/accordion-rounded-edges-issue-phdcxr?file=%2Fsrc%2FDemo.tsx%3A17%2C41

Steps: Add a TextField as a sibling of an Accordion with rounded edges - notice the rounded edges no longer exist.

Current behavior 😯

When another component like a TextField is a sibling of an Accordion, the rounded edges and other styling from first/last-of-type styles no longer appear:

Screenshot 2023-12-21 at 1 25 32 PM

or

Screenshot 2023-12-21 at 1 26 08 PM
Expected behavior 🤔

I would expect those styles to be applied to the first and last Accordion even if there are other siblings around it like this:

Screenshot 2023-12-21 at 1 28 08 PM
Context 🔦

The workaround is to wrap the Accordions in a div to give them their own parent so this isn't a huge issue, but not sure if this is the intended behavior when rendered next to other components.

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.