Fix auto-scroll to new photo on mobile
This commit is contained in:
@@ -45,6 +45,14 @@ export default class PlaceDetails extends Component {
|
|||||||
this.isPhotoUploadModalOpen = false;
|
this.isPhotoUploadModalOpen = false;
|
||||||
if (typeof eventId === 'string') {
|
if (typeof eventId === 'string') {
|
||||||
this.newlyUploadedPhotoId = eventId;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,10 +38,7 @@ export default class PlacePhotosCarousel extends Component {
|
|||||||
`[data-event-id="${eventId}"]`
|
`[data-event-id="${eventId}"]`
|
||||||
);
|
);
|
||||||
if (targetSlide) {
|
if (targetSlide) {
|
||||||
element.scrollTo({
|
element.scrollLeft = targetSlide.offsetLeft;
|
||||||
left: targetSlide.offsetLeft,
|
|
||||||
behavior: 'smooth',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -990,8 +990,8 @@ abbr[title] {
|
|||||||
.carousel-slide {
|
.carousel-slide {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
width: calc(100px * var(--slide-ratio, 1.7778));
|
width: auto;
|
||||||
aspect-ratio: auto;
|
aspect-ratio: var(--slide-ratio, 16 / 9);
|
||||||
scroll-snap-align: none;
|
scroll-snap-align: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user