@@ -16,6 +16,7 @@ import { CorePopovers } from '@services/overlays/popovers';
16
16
import { CoreFormatTextOptions } from '@components/bs-tooltip/bs-tooltip' ;
17
17
import { CoreModals } from '@services/overlays/modals' ;
18
18
import { CoreDom } from './dom' ;
19
+ import { CoreWait } from './wait' ;
19
20
20
21
/**
21
22
* Singleton with helper functions for Bootstrap.
@@ -459,7 +460,7 @@ export class CoreBootstrap {
459
460
} ;
460
461
461
462
// Helper to perform slide/crossfade transition.
462
- const goToSlide = ( newIndex : number , direction : 'next' | 'prev' ) => {
463
+ const goToSlide = async ( newIndex : number , direction : 'next' | 'prev' ) => {
463
464
const items = Array . from ( element . querySelectorAll < HTMLElement > ( '.carousel-item' ) ) ;
464
465
const activeIndex = items . findIndex ( item => item . classList . contains ( 'active' ) ) ;
465
466
if ( newIndex === activeIndex || newIndex < 0 || newIndex >= items . length ) {
@@ -475,8 +476,8 @@ export class CoreBootstrap {
475
476
476
477
// Animation.
477
478
nextItem . classList . add ( direction === 'next' ? 'carousel-item-next' : 'carousel-item-prev' ) ;
478
- // Force reflow for transition.
479
- void nextItem . offsetWidth ;
479
+ // Wait the render to finish to start the transition.
480
+ await CoreWait . nextTick ( ) ;
480
481
481
482
activeItem . classList . add ( direction === 'next' ? 'carousel-item-start' : 'carousel-item-end' ) ;
482
483
nextItem . classList . add ( direction === 'next' ? 'carousel-item-start' : 'carousel-item-end' ) ;
0 commit comments