diff --git a/frontend/src/settings/Logs.tsx b/frontend/src/settings/Logs.tsx index 8f38af82..aec4c42f 100644 --- a/frontend/src/settings/Logs.tsx +++ b/frontend/src/settings/Logs.tsx @@ -429,7 +429,16 @@ function Log({ return (
onToggle(log.id)} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + onToggle(log.id); + } + }} className={`text-foreground flex cursor-pointer flex-row items-start gap-2 p-2 px-4 py-3 ${ isOpen ? 'dark:bg-background rounded-t-xl bg-[#F1F1F1]' : '' }`} diff --git a/frontend/src/settings/traces/traceUtils.test.ts b/frontend/src/settings/traces/traceUtils.test.ts index 1a07167e..106c3dc8 100644 --- a/frontend/src/settings/traces/traceUtils.test.ts +++ b/frontend/src/settings/traces/traceUtils.test.ts @@ -94,6 +94,7 @@ describe('formatDurationMs', () => { [1234, '1.23 s'], [15432, '15.4 s'], [65000, '1m 05s'], + [119_600, '2m 00s'], ])('%s -> %s', (ms, expected) => { expect(formatDurationMs(ms)).toBe(expected); }); diff --git a/frontend/src/settings/traces/traceUtils.ts b/frontend/src/settings/traces/traceUtils.ts index 3f748328..e077299c 100644 --- a/frontend/src/settings/traces/traceUtils.ts +++ b/frontend/src/settings/traces/traceUtils.ts @@ -78,8 +78,10 @@ export function formatDurationMs(ms: number | null | undefined): string { if (ms < 1000) return `${Math.round(ms)} ms`; if (ms < 10_000) return `${(ms / 1000).toFixed(2)} s`; if (ms < 60_000) return `${(ms / 1000).toFixed(1)} s`; - const minutes = Math.floor(ms / 60_000); - const seconds = Math.round((ms % 60_000) / 1000); + // Round to whole seconds before splitting, so 119.6 s reads 2m 00s, not 1m 60s. + const totalSeconds = Math.round(ms / 1000); + const minutes = Math.floor(totalSeconds / 60); + const seconds = totalSeconds % 60; return `${minutes}m ${String(seconds).padStart(2, '0')}s`; }