diff --git a/components/poll/poll.tsx b/components/poll/poll.tsx index 2779c34e1..454651f3e 100644 --- a/components/poll/poll.tsx +++ b/components/poll/poll.tsx @@ -28,48 +28,31 @@ if (typeof window !== "undefined") { const MotionButton = motion(Button); -// There's a bug in Safari 15.4 that causes `scroll` to no work as intended -const isSafariV154 = - typeof window !== "undefined" - ? /Version\/15.[4-9]\sSafari/.test(navigator.userAgent) - : false; - export const ControlledScrollDiv: React.VoidFunctionComponent<{ children?: React.ReactNode; className?: string; }> = ({ className, children }) => { - const { setScrollPosition, availableSpace, scrollPosition } = - usePollContext(); + const { availableSpace, scrollPosition } = usePollContext(); const ref = React.useRef(null); - const didSetInitialScrollPosition = React.useRef(false); - - React.useEffect(() => { - if (ref.current) { - if (!isSafariV154) { - ref.current.scroll({ - left: scrollPosition, - behavior: didSetInitialScrollPosition?.current ? "smooth" : "auto", - }); - } else { - ref.current.scrollLeft = scrollPosition; - } - didSetInitialScrollPosition.current = true; - } - }, [scrollPosition]); - return (
{ - const div = e.target as HTMLDivElement; - setScrollPosition(div.scrollLeft); - }} > - {children} + + {children} +
); };