diff --git a/src/components/media-modal.jsx b/src/components/media-modal.jsx
index 30584c08..4290035e 100644
--- a/src/components/media-modal.jsx
+++ b/src/components/media-modal.jsx
@@ -241,15 +241,11 @@ function MediaModal({
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
+ carouselRef.current.focus();
carouselRef.current.scrollTo({
left: carouselRef.current.clientWidth * (currentIndex - 1),
behavior: 'smooth',
});
- setTimeout(() => {
- // Delay is needed for Safari, the focus stops it from scrolling
- // 1000 is hypothetical
- carouselRef.current?.focus();
- }, 1000);
}}
>
@@ -261,15 +257,11 @@ function MediaModal({
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
+ carouselRef.current.focus();
carouselRef.current.scrollTo({
left: carouselRef.current.clientWidth * (currentIndex + 1),
behavior: 'smooth',
});
- setTimeout(() => {
- // Delay is needed for Safari, the focus stops it from scrolling
- // 1000 is hypothetical
- carouselRef.current?.focus();
- }, 1000);
}}
>