Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Living wiki of UI design patterns and best practices built with Fumadocs, Next.js, and Base UI components.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
rules/prefetch-touch-fallback.md
1---2title: Fall Back Gracefully on Touch Devices3impact: MEDIUM4tags: prefetch, touch, mobile, fallback5---67## Fall Back Gracefully on Touch Devices89Touch devices have no cursor. Fall back to viewport or touch-start strategies automatically.1011**Incorrect (assumes cursor exists):**1213```tsx14function PrefetchLink({ href, children }) {15return (16<Link17href={href}18onMouseMove={() => prefetch(href)}19>20{children}21</Link>22);23}24```2526**Correct (device-aware strategy):**2728```tsx29const { elementRef } = useForesight({30callback: () => router.prefetch(href),31hitSlop: 20,32});33// Automatically falls back to touch-start on mobile34```35