diff --git a/packages/client/src/components/MkMediaList.vue b/packages/client/src/components/MkMediaList.vue index 0b4ed9dac..6ee427388 100644 --- a/packages/client/src/components/MkMediaList.vue +++ b/packages/client/src/components/MkMediaList.vue @@ -108,6 +108,7 @@ onMounted(() => { }, imageClickAction: "close", tapAction: "toggle-controls", + preloadFirstSlide: false, pswpModule: PhotoSwipe, }); @@ -162,7 +163,22 @@ onMounted(() => { }); }); + lightbox.on("afterInit", () => { + history.pushState(null, "", location.href); + addEventListener("popstate", close); + }) + lightbox.on("close", () => { + removeEventListener("popstate", close); + history.back(); + }) + lightbox.init(); + + function close() { + removeEventListener("popstate", close); + history.forward(); + lightbox.pswp.close(); + } }); const previewable = (file: misskey.entities.DriveFile): boolean => { diff --git a/packages/client/src/components/MkModal.vue b/packages/client/src/components/MkModal.vue index 0a07f57e0..287fb1d8c 100644 --- a/packages/client/src/components/MkModal.vue +++ b/packages/client/src/components/MkModal.vue @@ -74,7 +74,7 @@