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

[Bug]: Accordion with flush alignment does not meet design spec #15849

Closed
2 tasks done
janhassel opened this issue Feb 29, 2024 · 1 comment · Fixed by #15993
Closed
2 tasks done

[Bug]: Accordion with flush alignment does not meet design spec #15849

janhassel opened this issue Feb 29, 2024 · 1 comment · Fixed by #15993
Assignees
Labels
component: accordion role: dev 🤖 severity: 3 User can complete task, and/or has a workaround type: bug 🐛

Comments

@janhassel
Copy link
Member

janhassel commented Feb 29, 2024

Package

@carbon/react

Browser

Safari

Package version

1.51.1

React version

No response

Description

According to the design guidance, the Accordion titles are flush with the dividing lines when using the isFlush variant.

image

In the storybook, this not the case currently:

image

Reproduction/example

https://react.carbondesignsystem.com/?path=/story/components-accordion--playground&args=isFlush:!true

Steps to reproduce

Enable isFlush in the storybook's controls.

Suggested Severity

Severity 4 = Unrelated to a user task, has a workaround or does not need a workaround.

Application/PAL

No response

Code of Conduct

@tay1orjones
Copy link
Member

So I think the approach here will have to be - when isFlush:

  • There should be no padding on the accordion item(s) so that the title text and chevron sit flush with the left and right edge of the border
  • The focus/active/hover/etc. states should extend beyond the width of the accordion container

One way we can approach the focus/etc. states would be to use a pseudo element on the pseudo-class and give it something like

.cds--accordion__heading:focus::after {
  content: "";
  display: block;
  position: absolute;
  inline-size: calc(100% + $spacing-05 + $spacing-05);
  block-size: calc(); // this height will need calculated somehow based on 1rem (the default font size) + interior top/bottom padding or margin within the item
  inset-inline-start: $spacing-05;
  ... additional focus ring styling or whatever else
}

.cds--accordion__heading:hover::after {
  // ... hover styles
}

// ... etc states

This should ensure the overall accordion width is the same when isFlush and !isFlush, while allowing the states to visibly extend beyond the outside edges of the component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: accordion role: dev 🤖 severity: 3 User can complete task, and/or has a workaround type: bug 🐛
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants