import { useEffect, useRef } from 'react'; interface HelpPanelProps { open: boolean; onClose: () => void; } export function HelpPanel({ open, onClose }: HelpPanelProps) { const panel = useRef(null); useEffect(() => { if (!open) return; const returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null; const dialog = panel.current; const focusable = () => dialog ? [...dialog.querySelectorAll(FOCUSABLE_SELECTOR)] : []; focusable()[0]?.focus(); const handleKeyDown = (event: KeyboardEvent) => { if (event.key === 'Escape') { event.preventDefault(); onClose(); return; } if (event.key !== 'Tab') return; const elements = focusable(); const first = elements[0]; const last = elements.at(-1); if (!first || !last) return; if (event.shiftKey && document.activeElement === first) { event.preventDefault(); last.focus(); } else if (!event.shiftKey && document.activeElement === last) { event.preventDefault(); first.focus(); } }; document.addEventListener('keydown', handleKeyDown); return () => { document.removeEventListener('keydown', handleKeyDown); returnFocus?.focus(); }; }, [open, onClose]); if (!open) return null; return (
event.target === event.currentTarget && onClose()} >

Toolbox guide

Choose and arrange your tools

Open: click anywhere on a tool tile that is not a control.

Filter: search, choose a category, or click a tag. Click the selected tag again to clear it.

Arrange: pin frequently used tools into their own section, then drag the grip to reorder. The grip also supports keyboard dragging with Space, arrow keys, and Escape.

Privacy: each tile reports its declared processing, uploads, telemetry, and browser requirements before you open it.

); } const FOCUSABLE_SELECTOR = [ 'a[href]', 'button:not([disabled])', 'input:not([disabled])', 'select:not([disabled])', '[tabindex]:not([tabindex="-1"])', ].join(',');