diff --git a/packages/ui/client/components/trace/TraceView.vue b/packages/ui/client/components/trace/TraceView.vue index 4286e840f..744debad2 100644 --- a/packages/ui/client/components/trace/TraceView.vue +++ b/packages/ui/client/components/trace/TraceView.vue @@ -29,6 +29,35 @@ function onSelectStep(index: number) { } } +function onStepKeydown(event: KeyboardEvent, index: number) { + let nextIndex: number + if (event.key === 'ArrowUp') { + nextIndex = Math.max(index - 1, 0) + } + else if (event.key === 'ArrowDown') { + nextIndex = Math.min(index + 1, entries.value.length - 1) + } + else if (event.key === 'Home') { + nextIndex = 0 + } + else if (event.key === 'End') { + nextIndex = entries.value.length - 1 + } + else { + return + } + + event.preventDefault() + if (nextIndex === index) { + return + } + onSelectStep(nextIndex) + const nextButton = (event.currentTarget as HTMLButtonElement).parentElement?.children[nextIndex] + if (nextButton instanceof HTMLButtonElement) { + nextButton.focus() + } +} + watch([selectedStep, iframeEl], ([step, iframe]) => { if (!step || !iframe) { return @@ -143,18 +172,27 @@ function isTraceStepInProgress(step: NormalizedBrowserTraceEntry) { class="h-full min-h-0" > -
+