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

[accordion bug]: Adding elements to an accordion-item (without open attribute) causes overflow #11897

Open
2 tasks done
alexpeverett opened this issue Jun 26, 2024 · 1 comment
Labels
Feature request A new adopter requested feature

Comments

@alexpeverett
Copy link

alexpeverett commented Jun 26, 2024

The problem

The accordion-item does not automatically scale when elements are added if the accordion item is opened from a closed state. When the accordion is assigned an open attribute, the accordion-item scales correctly but if closed and re-opened, the bug persists.

Screen.Recording.2024-06-26.at.10.58.11.mov

The following video is when the accordion-item has an 'open' attribute assigned to it.

Screen.Recording.2024-06-26.at.10.59.05.mov

The solution

I have no idea what the solution is but the accordion-item should be able to scale up in size whether the open attribute is declared or not.

After doing some digging it appears that a div with the class name "cds--accordion__wrapper" applies a fixed size to the accordion item (max-block-size). However, when the open attribute is used, max-block-size is set to 'fit-content'. There is no part attribute that I can use to access the "cds--accordion__wrapper" div in the shadow root so I cannot (with my current knowledge) change the max-block-size CSS.

Screenshot 2024-06-26 at 16 01 51

Application/website

St4sd registry UI

Business priority

Very high Priority

What time frame would this ideally be needed by (if applicable)

Very high priority.

Examples

Examples are above.

Code of Conduct

@alexpeverett alexpeverett added the Feature request A new adopter requested feature label Jun 26, 2024
@alexpeverett
Copy link
Author

We temporarily fixed this by running the following function when we add a new item to the accordion.

export function fixAccordionStyle(id) {
  document
    .getElementById(id)
    .shadowRoot.querySelector(
      ".cds--accordion__wrapper",
    ).style.webkitMaxLogicalHeight = "fit-content";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request A new adopter requested feature
Projects
Status: No status
Development

No branches or pull requests

1 participant