From 73bd0c370597d674b94142c38b1161e4cf09edf0 Mon Sep 17 00:00:00 2001 From: Taufiq Date: Wed, 3 Dec 2025 15:31:02 +0700 Subject: [PATCH] fix: add autofocus functionality to CommandInput component --- apps/v4/registry/new-york-v4/ui/command.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apps/v4/registry/new-york-v4/ui/command.tsx b/apps/v4/registry/new-york-v4/ui/command.tsx index fdfcbccb763..36e8b12da57 100644 --- a/apps/v4/registry/new-york-v4/ui/command.tsx +++ b/apps/v4/registry/new-york-v4/ui/command.tsx @@ -64,6 +64,16 @@ function CommandInput({ className, ...props }: React.ComponentProps) { + const inputRef = React.useRef(null) + + React.useEffect(() => { + if (props.autoFocus && inputRef.current) { + requestAnimationFrame(() => { + inputRef.current?.focus() + }) + } + }, [props.autoFocus]) + return (