diff --git a/frontend/src/components/Tabs.tsx b/frontend/src/components/Tabs.tsx index 3bf5831..55d70f8 100644 --- a/frontend/src/components/Tabs.tsx +++ b/frontend/src/components/Tabs.tsx @@ -1,3 +1,5 @@ +import type { KeyboardEvent } from 'react'; + interface TabItem { id: string; label: string; @@ -11,12 +13,22 @@ interface TabsProps { } export function Tabs({ items, activeId, onChange }: TabsProps): JSX.Element { + function handleKeyDown(e: KeyboardEvent, index: number) { + if (e.key === 'ArrowRight') { + e.preventDefault(); + onChange(items[(index + 1) % items.length].id); + } else if (e.key === 'ArrowLeft') { + e.preventDefault(); + onChange(items[(index - 1 + items.length) % items.length].id); + } + } + return (
- {items.map((item) => { + {items.map((item, index) => { const isActive = item.id === activeId; return (