Changeset 9b36f45 in Klonkt for src/assets/js/audio-player.js


Ignore:
Timestamp:
06/14/2026 02:40:35 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
942028f
Parents:
b5bae24
Message:

audio: mobile — tapping a track automatically opens the now-playing sheet (Spotify style)

On mobile (CSS breakpoint <=719.98px) setQueue after a user-initiated track tap
from an album/playlist now automatically opens the full sheet instead of only
showing the mini strip. Only in setQueue (not next/prev or pre-seed), so a
deliberately closed sheet does not come back. Desktop unchanged.
Cache buster audio-player.js ?v=6 -> ?v=7 (Cloudflare 1y cache).

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/assets/js/audio-player.js

    rb5bae24 r9b36f45  
    323323  }
    324324
     325  // True when the viewport is in the mobile sheet-layout — matches the CSS
     326  // breakpoint where .audio-sheet slides up full-width from the bottom
     327  // (@media max-width:719.98px). On wider/desktop widths the sheet is a centered
     328  // panel, so we do NOT auto-open it there.
     329  function isMobileView() {
     330    return window.matchMedia('(max-width: 719.98px)').matches;
     331  }
     332
    325333  function setQueue(tracks, startIdx, opts) {
    326334    queue = Array.isArray(tracks) ? tracks.slice() : [];
     
    328336    if (!queue.length) return;
    329337    loadTrack(typeof startIdx === 'number' ? Math.max(0, Math.min(startIdx, queue.length - 1)) : 0, true);
     338    // Mobile: a track press from an album/playlist auto-opens the full
     339    // now-playing sheet (Spotify-style) i.p.v. alleen de dunne mini-strip.
     340    // Alleen hier (setQueue = een verse, door-de-gebruiker-gestarte queue) —
     341    // niet bij next/prev of de site-pre-seed — zodat een sheet die de gebruiker
     342    // bewust sloot niet vanzelf terugkomt.
     343    if (isMobileView()) openSheet();
    330344  }
    331345
Note: See TracChangeset for help on using the changeset viewer.