diff --git a/components/compare-form.tsx b/components/compare-form.tsx index a07f593..36ed9ce 100644 --- a/components/compare-form.tsx +++ b/components/compare-form.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useState, useRef, useEffect } from "react"; import { Button } from "./ui/button"; import { ArrowLeftRight, RefreshCw } from "lucide-react"; import { @@ -29,6 +29,12 @@ export function CompareForm({ }: CompareFormProps) { const [username1, setUsername1] = useState("pbiggar"); const [username2, setUsername2] = useState("CoralineAda"); + const firstInputRef = useRef(null); + + // Auto-focus first input on page load + useEffect(() => { + firstInputRef.current?.focus(); + }, []); const canSubmit = Boolean(username1.trim() && username2.trim() && !loading); @@ -63,6 +69,7 @@ export function CompareForm({
setUsername1(e.target.value)}