Increase timeout, but such hacky sadly

This commit is contained in:
Lim Chee Aun 2023-08-14 21:39:53 +08:00
parent fe8eb74242
commit e3c77cb516

View file

@ -246,8 +246,10 @@ function MediaModal({
behavior: 'smooth', behavior: 'smooth',
}); });
setTimeout(() => { setTimeout(() => {
carouselRef.current.focus(); // Delay is needed for Safari, the focus stops it from scrolling
}, 100); // 1000 is hypothetical
carouselRef.current?.focus();
}, 1000);
}} }}
> >
<Icon icon="arrow-left" /> <Icon icon="arrow-left" />
@ -264,8 +266,10 @@ function MediaModal({
behavior: 'smooth', behavior: 'smooth',
}); });
setTimeout(() => { setTimeout(() => {
carouselRef.current.focus(); // Delay is needed for Safari, the focus stops it from scrolling
}, 100); // 1000 is hypothetical
carouselRef.current?.focus();
}, 1000);
}} }}
> >
<Icon icon="arrow-right" /> <Icon icon="arrow-right" />