Skip to content

Commit 093d666

Browse files
committed
MOBILE-4891 bootstrap: Fix crossfading transition
1 parent 2ee90d0 commit 093d666

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/core/singletons/bootstrap.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { CorePopovers } from '@services/overlays/popovers';
1616
import { CoreFormatTextOptions } from '@components/bs-tooltip/bs-tooltip';
1717
import { CoreModals } from '@services/overlays/modals';
1818
import { CoreDom } from './dom';
19+
import { CoreWait } from './wait';
1920

2021
/**
2122
* Singleton with helper functions for Bootstrap.
@@ -459,7 +460,7 @@ export class CoreBootstrap {
459460
};
460461

461462
// Helper to perform slide/crossfade transition.
462-
const goToSlide = (newIndex: number, direction: 'next' | 'prev') => {
463+
const goToSlide = async (newIndex: number, direction: 'next' | 'prev') => {
463464
const items = Array.from(element.querySelectorAll<HTMLElement>('.carousel-item'));
464465
const activeIndex = items.findIndex(item => item.classList.contains('active'));
465466
if (newIndex === activeIndex || newIndex < 0 || newIndex >= items.length) {
@@ -475,8 +476,8 @@ export class CoreBootstrap {
475476

476477
// Animation.
477478
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();
480481

481482
activeItem.classList.add(direction === 'next' ? 'carousel-item-start' : 'carousel-item-end');
482483
nextItem.classList.add(direction === 'next' ? 'carousel-item-start' : 'carousel-item-end');

0 commit comments

Comments
 (0)