fix conflict

This commit is contained in:
Cory LaViska
2024-12-04 13:00:57 -05:00

View File

@@ -510,6 +510,12 @@ export default class SlCarousel extends ShoelaceElement {
// It's best to assume that we will and cleanup in the else case below if we didn't need to
this.pendingSlideChange = true;
window.requestAnimationFrame(() => {
// This can happen if goToSlide is called before the scroll container is rendered
// We will have correctly set the activeSlide in goToSlide which will get picked up when initializeSlides is called.
if (!this.scrollContainer) {
return;
}
const scrollContainer = this.scrollContainer;
const scrollContainerRect = scrollContainer.getBoundingClientRect();
const nextSlideRect = slide.getBoundingClientRect();