fix(web/m7-364): TrackRef field shape + seek-on-restore + drawer inert
CI svelte-check failed on 5 type errors caused by the slice using
duration_ms/album_name fields that don't exist on TrackRef (the real
shape uses duration_sec + album_id/album_title). Fixed across
QueueDrawer, QueueDrawer.test, QueueTrackRow.test, persisted.test,
and the inline `state.current = null` in PlayerBar.test (TrackRef |
undefined, not | null).
Final whole-slice review concerns also rolled in:
- C1 (Critical): persisted position was restored to UI but never
seeked into the audio element — first timeupdate snapped _position
back to 0. Added a one-shot _pendingRestorePosition module ref +
consumePendingRestorePosition() export; layout's loadedmetadata
handler now seeks once on restore.
- I1 (Important): throttled-write effect now wraps _queue / _index
reads in untrack so the dependency tracking matches the design
intent. Position remains the only tracked dep.
- I4 (Important): drawer gets inert={!queueDrawerOpen} so its inner
buttons drop out of tab order when closed (aria-hidden alone
doesn't do that). Removed redundant role="complementary" from
<aside> (implied by the element). New test asserts inert binding.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,10 +3,8 @@
|
||||
import { player, closeQueueDrawer } from '$lib/player/store.svelte';
|
||||
import QueueTrackRow from './QueueTrackRow.svelte';
|
||||
|
||||
function totalDurationLabel(tracks: { duration_ms: number }[]): string {
|
||||
const totalSec = Math.floor(
|
||||
tracks.reduce((s, tr) => s + (tr.duration_ms ?? 0), 0) / 1000
|
||||
);
|
||||
function totalDurationLabel(tracks: { duration_sec: number }[]): string {
|
||||
const totalSec = tracks.reduce((s, tr) => s + (tr.duration_sec ?? 0), 0);
|
||||
const m = Math.floor(totalSec / 60);
|
||||
const h = Math.floor(m / 60);
|
||||
return h > 0 ? `${h}h ${m % 60}m` : `${m} min`;
|
||||
@@ -23,9 +21,9 @@
|
||||
{/if}
|
||||
|
||||
<aside
|
||||
role="complementary"
|
||||
aria-label="Playback queue"
|
||||
aria-hidden={!player.queueDrawerOpen}
|
||||
inert={!player.queueDrawerOpen}
|
||||
class="fixed top-0 right-0 h-full w-full sm:w-96 bg-surface z-50
|
||||
transition-transform duration-200 flex flex-col
|
||||
{player.queueDrawerOpen ? 'translate-x-0' : 'translate-x-full'}"
|
||||
|
||||
Reference in New Issue
Block a user