@@ -48,6 +48,7 @@ export class Accordion implements ComponentInterface {
4848 private headerEl : HTMLDivElement | undefined ;
4949
5050 private currentRaf : number | undefined ;
51+ private skipNextAnimation = false ;
5152
5253 @Element ( ) el ?: HTMLElement ;
5354
@@ -295,6 +296,10 @@ export class Accordion implements ComponentInterface {
295296 * of what is set in the config.
296297 */
297298 private shouldAnimate = ( ) => {
299+ if ( this . skipNextAnimation ) {
300+ return false ;
301+ }
302+
298303 if ( typeof ( window as any ) === 'undefined' ) {
299304 return false ;
300305 }
@@ -316,6 +321,13 @@ export class Accordion implements ComponentInterface {
316321 return true ;
317322 } ;
318323
324+ private disableAnimationTemporarily ( ) {
325+ this . skipNextAnimation = true ;
326+ raf ( ( ) => {
327+ this . skipNextAnimation = false ;
328+ } ) ;
329+ }
330+
319331 private updateState = async ( initialUpdate = false ) => {
320332 const accordionGroup = this . accordionGroupEl ;
321333 const accordionValue = this . value ;
@@ -327,6 +339,11 @@ export class Accordion implements ComponentInterface {
327339 const value = accordionGroup . value ;
328340
329341 const shouldExpand = Array . isArray ( value ) ? value . includes ( accordionValue ) : value === accordionValue ;
342+ const shouldDisableAnimation = initialUpdate && shouldExpand ;
343+
344+ if ( shouldDisableAnimation ) {
345+ this . disableAnimationTemporarily ( ) ;
346+ }
330347
331348 if ( shouldExpand ) {
332349 this . expandAccordion ( initialUpdate ) ;
0 commit comments