fix: prevent video preview persisting when switching between recipes

This commit is contained in:
Will Miao
2026-02-08 11:18:41 +08:00
parent b4ad03c9bf
commit 2b74b2373d
2 changed files with 18 additions and 6 deletions

View File

@@ -140,6 +140,12 @@ export class ModalManager {
this.registerModal('recipeModal', {
element: recipeModal,
onClose: () => {
// Stop any playing video
const video = recipeModal.querySelector('video');
if (video) {
video.pause();
video.currentTime = 0;
}
this.getModal('recipeModal').element.style.display = 'none';
document.body.classList.remove('modal-open');
},