diff --git a/web/src/lib/components/PlaylistTrackRow.svelte b/web/src/lib/components/PlaylistTrackRow.svelte index c6916061..d3fb6d0c 100644 --- a/web/src/lib/components/PlaylistTrackRow.svelte +++ b/web/src/lib/components/PlaylistTrackRow.svelte @@ -41,6 +41,21 @@ onMove?.(row.position, row.position + delta); } + function handleHandleKeydown(e: KeyboardEvent) { + if (e.key === 'ArrowUp') { + e.preventDefault(); + onMove?.(row.position, row.position - 1); + } else if (e.key === 'ArrowDown') { + e.preventDefault(); + onMove?.(row.position, row.position + 1); + } else if (e.key === ' ' || e.key === 'Enter') { + // Reorder activates via arrow keys, not Space/Enter. Prevent + // default so Space doesn't scroll the list and Enter doesn't + // fire the button's no-op click. + e.preventDefault(); + } + } + function format(sec: number): string { const m = Math.floor(sec / 60); const s = sec % 60; @@ -74,12 +89,18 @@ }} > {#if isOwner} - - + {/if}