@@ -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,14 @@ export class Accordion implements ComponentInterface {
316321 return true ;
317322 } ;
318323
324+ private disableAnimationTemporarily ( ) {
325+ this . skipNextAnimation = true ;
326+ }
327+
328+ componentDidRender ( ) {
329+ this . skipNextAnimation = false ;
330+ }
331+
319332 private updateState = async ( initialUpdate = false ) => {
320333 const accordionGroup = this . accordionGroupEl ;
321334 const accordionValue = this . value ;
@@ -327,6 +340,11 @@ export class Accordion implements ComponentInterface {
327340 const value = accordionGroup . value ;
328341
329342 const shouldExpand = Array . isArray ( value ) ? value . includes ( accordionValue ) : value === accordionValue ;
343+ const shouldDisableAnimation = initialUpdate && shouldExpand ;
344+
345+ if ( shouldDisableAnimation ) {
346+ this . disableAnimationTemporarily ( ) ;
347+ }
330348
331349 if ( shouldExpand ) {
332350 this . expandAccordion ( initialUpdate ) ;
0 commit comments