@@ -208,26 +208,19 @@ export class Accordion implements ComponentInterface {
208
208
}
209
209
210
210
if ( this . shouldAnimate ( ) ) {
211
- this . state = AccordionState . Expanding ;
211
+ raf ( ( ) => {
212
+ this . state = AccordionState . Expanding ;
212
213
213
- this . currentRaf = raf ( async ( ) => {
214
- const contentHeight = contentElWrapper . offsetHeight ;
215
- const waitForTransition = transitionEndAsync ( contentEl , 2000 ) ;
216
- contentEl . style . setProperty ( 'max-height' , `${ contentHeight } px` ) ;
217
-
218
- /**
219
- * Force a repaint. We can't use an raf
220
- * here as it could cause the collapse animation
221
- * to get out of sync with the other
222
- * accordion's expand animation.
223
- */
224
- // tslint:disable-next-line
225
- void contentEl . offsetHeight ;
214
+ this . currentRaf = raf ( async ( ) => {
215
+ const contentHeight = contentElWrapper . offsetHeight ;
216
+ const waitForTransition = transitionEndAsync ( contentEl , 2000 ) ;
217
+ contentEl . style . setProperty ( 'max-height' , `${ contentHeight } px` ) ;
226
218
227
- await waitForTransition ;
219
+ await waitForTransition ;
228
220
229
- this . state = AccordionState . Expanded ;
230
- contentEl . style . removeProperty ( 'max-height' ) ;
221
+ this . state = AccordionState . Expanded ;
222
+ contentEl . style . removeProperty ( 'max-height' ) ;
223
+ } ) ;
231
224
} ) ;
232
225
} else {
233
226
this . state = AccordionState . Expanded ;
@@ -254,22 +247,16 @@ export class Accordion implements ComponentInterface {
254
247
const contentHeight = contentEl . offsetHeight ;
255
248
contentEl . style . setProperty ( 'max-height' , `${ contentHeight } px` ) ;
256
249
257
- /**
258
- * Force a repaint. We can't use an raf
259
- * here as it could cause the collapse animation
260
- * to get out of sync with the other
261
- * accordion's expand animation.
262
- */
263
- // tslint:disable-next-line
264
- void contentEl . offsetHeight ;
250
+ raf ( async ( ) => {
251
+ const waitForTransition = transitionEndAsync ( contentEl , 2000 ) ;
265
252
266
- const waitForTransition = transitionEndAsync ( contentEl , 2000 ) ;
267
- this . state = AccordionState . Collapsing ;
253
+ this . state = AccordionState . Collapsing ;
268
254
269
- await waitForTransition ;
255
+ await waitForTransition ;
270
256
271
- this . state = AccordionState . Collapsed ;
272
- contentEl . style . removeProperty ( 'max-height' ) ;
257
+ this . state = AccordionState . Collapsed ;
258
+ contentEl . style . removeProperty ( 'max-height' ) ;
259
+ } ) ;
273
260
} ) ;
274
261
} else {
275
262
this . state = AccordionState . Collapsed ;
0 commit comments