File tree Expand file tree Collapse file tree 3 files changed +22
-7
lines changed
elements/pfe-accordion/src Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -30,19 +30,24 @@ $LOCAL: accordion;
3030:host (:first-child ) {
3131 button {
3232 @include pfe-trigger-button-first ($theme : light );
33- }
33+ }
3434}
3535
3636
3737// Add border bottom to the last button in an accordion set.
3838:host (:last-of-type ) {
3939 button [aria-expanded = " false" ] {
4040 @include pfe-trigger-button-last ;
41- }
41+ }
4242}
4343
4444:host (.animating ) {
4545 transition : transform 0.3s #{pfe-var (animation-timing )} ;
46+
47+ button {
48+ @include pfe-trigger-expanded ;
49+ @include pfe-trigger-color-expanded ($theme : light , $component-name : accordion);
50+ }
4651}
4752
4853/// ===========================================================================
@@ -58,3 +63,9 @@ $LOCAL: accordion;
5863 }
5964 }
6065}
66+
67+ :host ([on = " dark" ].animating ){
68+ button {
69+ @include pfe-trigger-color-expanded ($theme : dark , $component-name : accordion);
70+ }
71+ }
Original file line number Diff line number Diff line change @@ -10,12 +10,14 @@ $LOCAL: accordion;
1010 @include pfe-accordion-panel ;
1111}
1212
13- :host ([expanded ]) {
13+ :host ([expanded ]),
14+ :host (.animating ) {
1415 @include pfe-accordion-panel-expanded ;
1516 @include pfe-accordion-panel-expanded-style ;
1617}
17-
18- :host ([on = " dark" ][expanded ]) {
18+
19+ :host ([on = " dark" ][expanded ]),
20+ :host ([on = " dark" ].animating ){
1921 @include pfe-theme ($theme : " dark" );
2022 @include pfe-accordion-panel-expanded-style ($theme : dark );
2123}
@@ -32,4 +34,3 @@ $LOCAL: accordion;
3234:host (:last-of-type [expanded ]) {
3335 margin-bottom : 0 ;
3436}
35-
Original file line number Diff line number Diff line change @@ -258,13 +258,14 @@ class PfeAccordion extends PFElement {
258258 }
259259
260260 _animate ( panel , start , end ) {
261+ const header = panel . previousElementSibling ;
261262 panel . classList . add ( "animating" ) ;
263+ header . classList . add ( "animating" ) ;
262264 panel . style . height = `${ start } px` ;
263265
264266 requestAnimationFrame ( ( ) => {
265267 requestAnimationFrame ( ( ) => {
266268 panel . style . height = `${ end } px` ;
267- panel . classList . add ( "animating" ) ;
268269 panel . addEventListener ( "transitionend" , this . _transitionEndHandler ) ;
269270 } ) ;
270271 } ) ;
@@ -306,6 +307,8 @@ class PfeAccordion extends PFElement {
306307 }
307308
308309 _transitionEndHandler ( evt ) {
310+ const header = evt . target . previousElementSibling ;
311+ header . classList . remove ( "animating" ) ;
309312 evt . target . style . height = "" ;
310313 evt . target . classList . remove ( "animating" ) ;
311314 evt . target . removeEventListener ( "transitionend" , this . _transitionEndHandler ) ;
You can’t perform that action at this time.
0 commit comments