From 860d551b437b822b9f651e3652a7b86e97206a7a Mon Sep 17 00:00:00 2001 From: Maxwell Barvian Date: Thu, 28 Nov 2024 09:34:46 -0800 Subject: [PATCH] Disable new overflow mask because of Chrome bug --- site/src/components/Nav.tsx | 54 ++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/site/src/components/Nav.tsx b/site/src/components/Nav.tsx index ccbddf0..fa4fd5f 100644 --- a/site/src/components/Nav.tsx +++ b/site/src/components/Nav.tsx @@ -1,6 +1,6 @@ import Link from '@/components/Link' import { BookOpen, Shapes, GalleryVerticalEnd } from 'lucide-react' -import { motion, MotionConfig, useMotionTemplate, useMotionValue } from 'motion/react' +import { motion, MotionConfig } from 'motion/react' import * as React from 'react' import clsx from 'clsx/lite' @@ -9,7 +9,7 @@ type Props = JSX.IntrinsicElements['nav'] & { repo?: string } -const maskWidth = '2.5rem' +// const maskWidth = '2.5rem' export default function Nav({ stargazers, className, repo, ...props }: Props) { // Fix scroll positions after view transitions: @@ -32,26 +32,26 @@ export default function Nav({ stargazers, className, repo, ...props }: Props) { } }, []) - // Scroll pos - const leftOverflow = useMotionValue(0) - const leftOverflowPx = useMotionTemplate`${leftOverflow}px` - const rightOverflow = useMotionValue(0) - const rightOverflowPx = useMotionTemplate`${rightOverflow}px` - React.useEffect(() => { - const onScroll = () => { - leftOverflow.set(scrollableRef.current!.scrollLeft) - rightOverflow.set( - scrollableRef.current!.scrollWidth - - scrollableRef.current!.clientWidth - - scrollableRef.current!.scrollLeft - ) - } - onScroll() - scrollableRef.current?.addEventListener('scroll', onScroll) - return () => { - scrollableRef.current?.removeEventListener('scroll', onScroll) - } - }, []) + // Overflow mask. Disable for now b/c of Chrome bug with mask-image and VTs: + // const leftOverflow = useMotionValue(0) + // const leftOverflowPx = useMotionTemplate`${leftOverflow}px` + // const rightOverflow = useMotionValue(0) + // const rightOverflowPx = useMotionTemplate`${rightOverflow}px` + // React.useEffect(() => { + // const onScroll = () => { + // leftOverflow.set(scrollableRef.current!.scrollLeft) + // rightOverflow.set( + // scrollableRef.current!.scrollWidth - + // scrollableRef.current!.clientWidth - + // scrollableRef.current!.scrollLeft + // ) + // } + // onScroll() + // scrollableRef.current?.addEventListener('scroll', onScroll) + // return () => { + // scrollableRef.current?.removeEventListener('scroll', onScroll) + // } + // }, []) return ( @@ -70,11 +70,11 @@ export default function Nav({ stargazers, className, repo, ...props }: Props) {