From 6a1354e52d7fdc88dd7c3b70ff4c4bbfbf75017c Mon Sep 17 00:00:00 2001 From: vinay <94120295+vinaykulk621@users.noreply.github.com> Date: Thu, 3 Aug 2023 23:52:38 +0530 Subject: [PATCH] fix(examples): update keyboard shortcut for opening dialog on Windows (#1004) --- apps/www/content/docs/components/command.mdx | 3 ++- apps/www/registry/default/example/command-dialog.tsx | 3 ++- apps/www/registry/new-york/example/command-dialog.tsx | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/www/content/docs/components/command.mdx b/apps/www/content/docs/components/command.mdx index 86a4505e3a..4459f986a5 100644 --- a/apps/www/content/docs/components/command.mdx +++ b/apps/www/content/docs/components/command.mdx @@ -102,7 +102,8 @@ export function CommandMenu() { React.useEffect(() => { const down = (e: KeyboardEvent) => { - if (e.key === "k" && e.metaKey) { + if (e.key === "k" && (e.metaKey || e.ctrlKey)) { + e.preventDefault() setOpen((open) => !open) } } diff --git a/apps/www/registry/default/example/command-dialog.tsx b/apps/www/registry/default/example/command-dialog.tsx index ea3ea39758..64c35c7166 100644 --- a/apps/www/registry/default/example/command-dialog.tsx +++ b/apps/www/registry/default/example/command-dialog.tsx @@ -26,7 +26,8 @@ export default function CommandDialogDemo() { React.useEffect(() => { const down = (e: KeyboardEvent) => { - if (e.key === "j" && e.metaKey) { + if (e.key === "j" && (e.metaKey || e.ctrlKey)) { + e.preventDefault() setOpen((open) => !open) } } diff --git a/apps/www/registry/new-york/example/command-dialog.tsx b/apps/www/registry/new-york/example/command-dialog.tsx index abb11c67ba..a40ff3cb9c 100644 --- a/apps/www/registry/new-york/example/command-dialog.tsx +++ b/apps/www/registry/new-york/example/command-dialog.tsx @@ -26,7 +26,8 @@ export default function CommandDialogDemo() { React.useEffect(() => { const down = (e: KeyboardEvent) => { - if (e.key === "j" && e.metaKey) { + if (e.key === "j" && (e.metaKey || e.ctrlKey)) { + e.preventDefault() setOpen((open) => !open) } }