Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions apps/v4/registry/new-york-v4/ui/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,21 @@ function Command({
className,
...props
}: React.ComponentProps<typeof CommandPrimitive>) {

const handleKeyDown = (e: React.KeyboardEvent) => {
// On MacOS with VoiceOver enabled, arrow keys are used for screen reader navigation.
// Returning early here prevents cmdk's default key handling (which calls preventDefault),
// allowing VoiceOver to manage focus movement between options.
const isMac = typeof window !== "undefined" && navigator.platform.includes("Mac");
if (isMac && e.key === "ArrowDown") {
return ; // Allow VoiceOver to handle arrow key navigation
}
}

return (
<CommandPrimitive
data-slot="command"
onKeyDown={handleKeyDown}
className={cn(
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
className
Expand Down Expand Up @@ -88,6 +100,8 @@ function CommandList({
}: React.ComponentProps<typeof CommandPrimitive.List>) {
return (
<CommandPrimitive.List
role = "listbox"
aria-label="Command options"
data-slot="command-list"
className={cn(
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
Expand Down Expand Up @@ -145,6 +159,9 @@ function CommandItem({
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
return (
<CommandPrimitive.Item
role="option"
tabIndex={0}
aria-selected={props['data-selected'] === true}
data-slot="command-item"
className={cn(
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
Expand Down