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:
2026-05-03 22:14:59 -04:00
parent 49c8e5959e
commit d83b3eab25
7 changed files with 53 additions and 20 deletions
+5 -3
View File
@@ -16,11 +16,13 @@ vi.mock('$lib/player/store.svelte', () => ({
const sampleTrack: TrackRef = {
id: 't1',
title: 'Song Title',
album_id: 'al1',
album_title: 'Album',
artist_id: 'ar1',
artist_name: 'Artist Name',
album_name: 'Album',
duration_ms: 200000,
duration_sec: 200,
stream_url: '/stream/t1'
} as TrackRef;
};
describe('QueueTrackRow', () => {
beforeEach(() => {