From e3c77cb5169885142bab1a74796400d86c79442e Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 14 Aug 2023 21:39:53 +0800 Subject: [PATCH] Increase timeout, but such hacky sadly --- src/components/media-modal.jsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/media-modal.jsx b/src/components/media-modal.jsx index 721b6ef6..30584c08 100644 --- a/src/components/media-modal.jsx +++ b/src/components/media-modal.jsx @@ -246,8 +246,10 @@ function MediaModal({ behavior: 'smooth', }); setTimeout(() => { - carouselRef.current.focus(); - }, 100); + // Delay is needed for Safari, the focus stops it from scrolling + // 1000 is hypothetical + carouselRef.current?.focus(); + }, 1000); }} > @@ -264,8 +266,10 @@ function MediaModal({ behavior: 'smooth', }); setTimeout(() => { - carouselRef.current.focus(); - }, 100); + // Delay is needed for Safari, the focus stops it from scrolling + // 1000 is hypothetical + carouselRef.current?.focus(); + }, 1000); }} >