diff --git a/apps/examples/src/examples/custom-keyboard-shortcuts-dialog/CustomKeyboardShortcutsDialogExample.tsx b/apps/examples/src/examples/custom-keyboard-shortcuts-dialog/CustomKeyboardShortcutsDialogExample.tsx index 4a9cd99ba..3759ff623 100644 --- a/apps/examples/src/examples/custom-keyboard-shortcuts-dialog/CustomKeyboardShortcutsDialogExample.tsx +++ b/apps/examples/src/examples/custom-keyboard-shortcuts-dialog/CustomKeyboardShortcutsDialogExample.tsx @@ -12,10 +12,11 @@ function CustomKeyboardShortcutsDialog(props: TLUiKeyboardShortcutsDialogProps) return ( { window.open('https://x.com/tldraw', '_blank') }} diff --git a/packages/tldraw/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx b/packages/tldraw/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx index f27a8c75e..cfcead0a0 100644 --- a/packages/tldraw/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +++ b/packages/tldraw/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx @@ -42,8 +42,6 @@ export function DefaultKeyboardShortcutsDialogContent() { - - diff --git a/packages/tldraw/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx b/packages/tldraw/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx index f5b104d92..e22da3606 100644 --- a/packages/tldraw/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +++ b/packages/tldraw/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx @@ -172,13 +172,18 @@ export function TldrawUiMenuItem< ) } case 'keyboard-shortcuts': { - if (!kbd) return null + if (!kbd) { + console.warn( + `Menu item '${label}' isn't shown in the keyboard shortcuts dialog because it doesn't have a keyboard shortcut.` + ) + return null + } return (
{labelStr}
- {kbd!} + {kbd}
)