Hi,

I want to insert into the Panel title (for a) small signs that indicate whether the accordion is collapsed or expanded, but I could not find the appropriate selectors. When the accordion is loaded (collapsed) there is no css class. There is an attribute aria-expanded="true" (which is not true in that state). After expanding the accordion, there is still no css class, but after closing again there is a class="collapsed".

It would help, to have the appropriate classes for the expanded and collapsed state.

Greetings Julius

Comments

julius95 created an issue. See original summary.

  • thejimbirch committed 08c52de on 8.x-2.x
    Issue #2888729 by thejimbirch: Changes initial aria-expanded to false...
thejimbirch’s picture

Category: Feature request » Bug report
Status: Active » Fixed
thejimbirch’s picture

Hi Julius,

I tried playing around with the classes, but could not get that to work without adding javascript.

Instead I simply changed the initial aria-expanded to false, which like you said it was any way. And now you can target the appropriate open/closed states with the following rules:

.paragraph--type--bp-accordion .panel-title > a[aria-expanded="true"] {
    color: red;
}

.paragraph--type--bp-accordion .panel-title > a[aria-expanded="false"] {
    color: purple;
}

This is committed to the dev branch.

Thanks for the issue!

Jim

julius95’s picture

Category: Bug report » Feature request
Status: Fixed » Active

Thanks Jim, selecting an attribute would do it. Then the expanded class is not necessary any more.

Julius

thejimbirch’s picture

Category: Feature request » Bug report
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.