remix-run / remix-website

327 stars 74 forks source link

Docs Nav Scroll restoration #236

Closed brookslybrand closed 5 months ago

brookslybrand commented 5 months ago

Improving the docs collapsable categories a bit

brookslybrand commented 5 months ago

I'm trying to get the scroll to automatically work (#233).

Tried a JS approach, but there's a pretty ugly CLS, which is not really worth it

// in MenuLink component
      ref={(node) => {
        const isMounted = mounted.current;
        if (!isActive || isMounted) return;

        console.log("scroll into view", to);

        node?.scrollIntoView({
          behavior: "instant",
          block: "center",
        });
      }}