"use client"; import { ArrowUp } from "lucide-react"; import { useEffect, useState } from "react"; import { cn } from "@/lib/utils"; /** * Floating "back to top" button, stacked above the `?` shortcuts trigger. It * shows once the reader is a screen down, jumps instantly, and moves focus to * the enclosing `
` (tabIndex -1) because the button hides at the top. */ export function ReportBackToTop() { const [shown, setShown] = useState(false); useEffect(() => { const onScroll = () => setShown(window.scrollY > window.innerHeight); onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); return () => window.removeEventListener("scroll", onScroll); }, []); return ( ); }