Skip to content

Commit d7a2c07

Browse files
authored
fix: shortcuts (#730)
1 parent 24c2253 commit d7a2c07

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

apps/sim/app/workspace/[workspaceId]/w/components/search-modal/search-modal.tsx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -394,19 +394,28 @@ export function SearchModal({
394394
// Only handle shortcuts when modal is open
395395
if (!open) return
396396

397-
// Don't trigger if user is typing in the search input
398-
const activeElement = document.activeElement
399-
const isEditableElement =
400-
activeElement instanceof HTMLInputElement ||
401-
activeElement instanceof HTMLTextAreaElement ||
402-
activeElement?.hasAttribute('contenteditable')
403-
404-
if (isEditableElement) return
405-
406397
const isMac =
407398
typeof navigator !== 'undefined' && navigator.platform.toUpperCase().indexOf('MAC') >= 0
408399
const isModifierPressed = isMac ? e.metaKey : e.ctrlKey
409400

401+
// Check if this is one of our specific shortcuts
402+
const isOurShortcut =
403+
isModifierPressed &&
404+
e.shiftKey &&
405+
(e.key.toLowerCase() === 'l' || e.key.toLowerCase() === 'k')
406+
407+
// Don't trigger other shortcuts if user is typing in the search input
408+
// But allow our specific shortcuts to pass through
409+
if (!isOurShortcut) {
410+
const activeElement = document.activeElement
411+
const isEditableElement =
412+
activeElement instanceof HTMLInputElement ||
413+
activeElement instanceof HTMLTextAreaElement ||
414+
activeElement?.hasAttribute('contenteditable')
415+
416+
if (isEditableElement) return
417+
}
418+
410419
if (isModifierPressed && e.shiftKey) {
411420
// Command+Shift+L - Navigate to Logs
412421
if (e.key.toLowerCase() === 'l') {
@@ -541,7 +550,7 @@ export function SearchModal({
541550
className='bg-white/50 dark:bg-black/50'
542551
style={{ backdropFilter: 'blur(4.8px)' }}
543552
/>
544-
<DialogPrimitive.Content className='data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 flex h-[580px] w-[700px] translate-x-[-50%] translate-y-[-50%] flex-col gap-0 overflow-hidden rounded-xl border border-border bg-background p-0 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in'>
553+
<DialogPrimitive.Content className='data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 flex h-[580px] w-[700px] translate-x-[-50%] translate-y-[-50%] flex-col gap-0 overflow-hidden rounded-xl border border-border bg-background p-0 shadow-lg duration-200 focus:outline-none focus-visible:outline-none data-[state=closed]:animate-out data-[state=open]:animate-in'>
545554
<VisuallyHidden.Root>
546555
<DialogTitle>Search</DialogTitle>
547556
</VisuallyHidden.Root>

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,6 @@ export function Sidebar() {
735735
icon: LibraryBig,
736736
href: `/workspace/${workspaceId}/knowledge`,
737737
tooltip: 'Knowledge',
738-
shortcut: getKeyboardShortcutText('K', true, true),
739738
active: pathname === `/workspace/${workspaceId}/knowledge`,
740739
},
741740
{

0 commit comments

Comments
 (0)