Fix auto-scroll to new photo on mobile

This commit is contained in:
2026-04-22 11:32:37 +04:00
parent 4fed8c05c5
commit c853418fbb
3 changed files with 11 additions and 6 deletions

View File

@@ -45,6 +45,14 @@ export default class PlaceDetails extends Component {
this.isPhotoUploadModalOpen = false;
if (typeof eventId === 'string') {
this.newlyUploadedPhotoId = eventId;
// Allow DOM to update first, then scroll to the top to show the new photo in the carousel
setTimeout(() => {
const sidebar = document.querySelector('.sidebar-content');
if (sidebar) {
sidebar.scrollTop = 0;
}
}, 50);
}
}

View File

@@ -38,10 +38,7 @@ export default class PlacePhotosCarousel extends Component {
`[data-event-id="${eventId}"]`
);
if (targetSlide) {
element.scrollTo({
left: targetSlide.offsetLeft,
behavior: 'smooth',
});
element.scrollLeft = targetSlide.offsetLeft;
}
}, 100);
}