From f4ad67047b4d4471dc46fee838f36784a476f36a Mon Sep 17 00:00:00 2001 From: David Crespo Date: Thu, 29 Jan 2026 14:35:32 -0600 Subject: [PATCH] don't let route tabs eat cmd+arrow keypresses --- app/components/RouteTabs.tsx | 5 ++++- app/ui/util/keys.ts | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/components/RouteTabs.tsx b/app/components/RouteTabs.tsx index ae2f22537..f82181cd4 100644 --- a/app/components/RouteTabs.tsx +++ b/app/components/RouteTabs.tsx @@ -10,9 +10,12 @@ import type { ReactNode } from 'react' import { Link, Outlet } from 'react-router' import { useIsActivePath } from '~/hooks/use-is-active-path' -import { KEYS } from '~/ui/util/keys' +import { hasModifier, KEYS } from '~/ui/util/keys' const selectTab = (e: React.KeyboardEvent) => { + // Don't intercept modified arrow keys (Cmd for browser back/forward, etc.) + if (hasModifier(e)) return + const target = e.target as HTMLDivElement if (e.key === KEYS.left) { e.stopPropagation() diff --git a/app/ui/util/keys.ts b/app/ui/util/keys.ts index c67555a7b..b59ba933f 100644 --- a/app/ui/util/keys.ts +++ b/app/ui/util/keys.ts @@ -21,3 +21,8 @@ export const KEYS = { space: ' ', escape: 'Escape', } as const + +/** Returns true if any modifier key is held */ +export const hasModifier = ( + e: Pick +) => e.metaKey || e.ctrlKey || e.shiftKey || e.altKey