Skip to content

feat(queue): highlight and scroll to the current track - #103

Open
Lisiadito wants to merge 1 commit into
eremef:mainfrom
Lisiadito:feat/queue-follow-current-track
Open

feat(queue): highlight and scroll to the current track#103
Lisiadito wants to merge 1 commit into
eremef:mainfrom
Lisiadito:feat/queue-follow-current-track

Conversation

@Lisiadito

Copy link
Copy Markdown
Collaborator

The playing track was hard to find in both queue views: the highlight was a faint tint and neither platform ever scrolled, so on a long queue the current track was usually off-screen.

Highlight: keep the tinted background, add a left accent bar and a bolder accent title. Desktop uses an inset box-shadow rather than border-left so the row does not shift and it does not collide with the drag-over border; mobile reserves the 3px border on every row and only changes its colour.

Auto-scroll: on open (desktop panel unmounts when closed, so mount-time positioning suffices) / on tab focus (mobile tabs stay mounted), and again on every track change. Guarded by one rule on both platforms — skip if a drag is in progress, or if the outgoing current row was not on screen — so it follows while you watch the playing area and leaves you alone once you scroll off to browse. Known limitation: a track change landing mid-drag is dropped, not replayed.

Also fixes two bugs:

  • Virtuoso renders initialItemCount rows starting AT initialTopMostItemIndex and never clamps that window against the data length, handing itemContent an undefined item. Reachable for any queue shorter than the count with the current track off the first row (a 12-track album on track 5). Both props are now derived together, with an !item bail as a net.

  • The mobile current-row tint used colors.input, which equals colors.background (#000000) in the high-contrast palette, making the highlight invisible there. Adds a dedicated highlight token to all three palettes.

Row geometry on mobile is now derived from shared constants and the row height is pinned, so getItemLayout cannot drift under OS font scaling.

Tests: new QueuePanel.autoscroll.test.tsx mocks react-virtuoso (the real one can never report a scroll under happy-dom, where the scroller's offsetHeight is always 0) while the existing suite keeps exercising the real component; the mobile suite gains highlight coverage including high-contrast. Each guard was mutation-tested so it is not passing vacuously.

The playing track was hard to find in both queue views: the highlight was a
faint tint and neither platform ever scrolled, so on a long queue the current
track was usually off-screen.

Highlight: keep the tinted background, add a left accent bar and a bolder
accent title. Desktop uses an inset box-shadow rather than border-left so the
row does not shift and it does not collide with the drag-over border; mobile
reserves the 3px border on every row and only changes its colour.

Auto-scroll: on open (desktop panel unmounts when closed, so mount-time
positioning suffices) / on tab focus (mobile tabs stay mounted), and again on
every track change. Guarded by one rule on both platforms — skip if a drag is
in progress, or if the outgoing current row was not on screen — so it follows
while you watch the playing area and leaves you alone once you scroll off to
browse. Known limitation: a track change landing mid-drag is dropped, not
replayed.

Also fixes two bugs:

- Virtuoso renders initialItemCount rows starting AT initialTopMostItemIndex
  and never clamps that window against the data length, handing itemContent an
  undefined item. Reachable for any queue shorter than the count with the
  current track off the first row (a 12-track album on track 5). Both props are
  now derived together, with an !item bail as a net.

- The mobile current-row tint used colors.input, which equals colors.background
  (#000000) in the high-contrast palette, making the highlight invisible there.
  Adds a dedicated highlight token to all three palettes.

Row geometry on mobile is now derived from shared constants and the row height
is pinned, so getItemLayout cannot drift under OS font scaling.

Tests: new QueuePanel.autoscroll.test.tsx mocks react-virtuoso (the real one
can never report a scroll under happy-dom, where the scroller's offsetHeight is
always 0) while the existing suite keeps exercising the real component; the
mobile suite gains highlight coverage including high-contrast. Each guard was
mutation-tested so it is not passing vacuously.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant