Skip to content

feat(web): row-click selection on playlist tracks in edit mode#14324

Open
dylanjeffers wants to merge 3 commits into
claude/track-multi-selectfrom
claude/per-row-selection
Open

feat(web): row-click selection on playlist tracks in edit mode#14324
dylanjeffers wants to merge 3 commits into
claude/track-multi-selectfrom
claude/per-row-selection

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

@dylanjeffers dylanjeffers commented May 15, 2026

Summary

Wires up row-level selection on the playlist detail page when edit mode is active. Clicking a row toggles its selection in the bulk-actions context (added in #14323) instead of playing the track; holding shift extends the selection over the range between the anchor (last plain click) and the new row.

Stacked on #14323#14322#14321#14320#14319#14318.

Implementation

  • New EditAwareTracksTable wraps the standard TracksTable:
    • When edit mode is active for the current collection, intercepts onClickRow(track, index) to call selection.toggle(track.track_id, index, { shift }) instead of the original handler.
    • TracksTable's onClickRow does not receive a MouseEvent, so the wrapper tracks the shift key globally via window keydown/keyup listeners and reads it at click time. Also resets on window blur — without this, Cmd/Alt-Tabbing away while holding Shift would leave the modifier stuck true (the keyup fires in the other window).
    • Outside of edit mode the wrapper is a transparent pass-through; play-on-click works unchanged.
  • TrackSelectionContext.toggle keeps the anchor row stable across a shift-click sequence (matches Finder / Gmail / Drive): click A, shift-click C selects A..C; a follow-up shift-click E then selects A..E (not C..E). The anchor only moves on a plain click.
  • CollectionPage swaps its TracksTable instantiation for the new wrapper and passes the collection id.
  • Per-row highlight: TracksTable now accepts an optional rowClassNameAddition(track, rowIndex) that's composed with the existing internal per-row className (used for locked/disabled state). EditAwareTracksTable uses it to apply a selected class — surface-2 background fill plus a 3px accent bar on the left edge — to rows whose track id is in the selection set.

With this PR, the full track-curation flow from the spec is wired:

  • Single-click → toggle selection
  • Shift-click → range select (anchor-preserving)
  • Cmd/Ctrl+A → Select all
  • Escape → Clear selection
  • Delete → Remove selected
  • Cmd/Ctrl+Z / Cmd/Ctrl+Y → Undo / Redo
  • Toolbar buttons for Copy URLs and Remove

Test plan

  • Enter edit mode on your playlist.
  • Click a row → bar shows "1 selected"; row gains the surface-2 highlight; play state does not change.
  • Click another row → "2 selected"; both rows highlighted.
  • Shift-click a third row further down → the entire range from the anchor to that row is added and highlighted.
  • Shift-click an even further row → the range still extends from the original anchor, not from the previous shift-click target.
  • Click a selected row (no shift) → it is removed from the selection and the highlight is dropped.
  • Hold Shift, Cmd-Tab to another app, release Shift outside the window, return, and click a row → it should toggle (not range-extend), proving the blur reset works.
  • Exit edit mode → click a row → playback starts as before, no highlight.

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 15, 2026

⚠️ No Changeset found

Latest commit: 0402d02

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pull-request-size pull-request-size Bot added size/L and removed size/M labels May 15, 2026
@dylanjeffers dylanjeffers force-pushed the claude/track-multi-select branch from 46c2b73 to c539a7b Compare May 15, 2026 18:12
dylanjeffers and others added 2 commits May 15, 2026 11:12
While the playlist detail page is in edit mode, clicking a track row
toggles its selection in the bulk-actions context instead of playing
the track. Holding shift while clicking extends the selection over
the range between the previous click and the new one.

- New `EditAwareTracksTable` wrapper around the standard
  `TracksTable`. It captures the global shift-key state with a
  window listener (TracksTable's onClickRow does not pass a
  MouseEvent) and rewrites `onClickRow` to call
  `selection.toggle(id, index, { shift })` when edit mode is active.
- Outside of edit mode the wrapper is a transparent pass-through and
  the existing play-on-click behavior is preserved.
- Desktop `CollectionPage` swaps its `TracksTable` usage for the new
  edit-aware wrapper.

Combined with the bulk-actions bar from the previous PR, the user
can now: shift-click a range, Cmd/Ctrl+A to select all, Escape to
clear, Delete to remove, Cmd/Ctrl+Z/Y for undo/redo, and the bar's
Copy URLs / Remove buttons for bulk operations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Builds on the row-click selection from this branch to give the user
visible feedback for which tracks are currently selected.

- `TracksTable` gains an optional `rowClassNameAddition(track, index)`
  prop that's composed with the table's existing per-row className
  (used internally for the locked/disabled states). The hook is
  ref-stable so external state changes don't force a full re-render
  of the table machinery.
- `EditAwareTracksTable` passes a `rowClassNameAddition` that
  returns the new `selected` CSS class when the row's track id is
  in the selection set and the page is in edit mode. The class
  draws a surface-2 background fill and a 3px accent bar on the
  left edge so selected rows are immediately scannable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dylanjeffers dylanjeffers force-pushed the claude/per-row-selection branch from 13ec3ba to 8cc78cc Compare May 15, 2026 18:12
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14324.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

Two small correctness fixes on top of the existing row-click selection
in playlist edit mode.

- `EditAwareTracksTable` now resets its shift-key ref on `window` blur.
  Previously, holding Shift while Cmd/Alt-Tabbing away would leave the
  ref stuck true (the keyup fires in the other window), so the next
  click on return was interpreted as a shift-extend.
- `TrackSelectionContext.toggle` now keeps the anchor row stable across
  a sequence of shift-clicks. The anchor only moves on a plain click.
  This matches Finder / Gmail / Drive: click A, shift-click C selects
  A..C; a follow-up shift-click E then selects A..E (not C..E).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant