Skip to content

fix(ui): valid mini-player markup + reliable long-press - #31

Merged
EnesYilmazcode merged 1 commit into
mainfrom
claude/funny-hawking-930hed
Jul 15, 2026
Merged

EnesYilmazcode merged 1 commit into
mainfrom
claude/funny-hawking-930hed

Conversation

@EnesYilmazcode

Copy link
Copy Markdown
Owner

Fixes #6. Fixes #12.

#6 — invalid nested buttons

The mini bar was a <button> containing the play/next <button>s. That's invalid HTML; browsers "fix up" the nesting unpredictably, breaking the inner taps on iOS. Made the outer element a role="button" div (with Enter/Space keydown for a11y); the inner controls stay real <button>s and their stopPropagation still prevents opening Now Playing.

#12 — unreliable long-press

  • onTouchMove cancelled on any movement, so normal finger jitter killed the hold ~half the time → now only cancels past a 10px tolerance.
  • Added onTouchCancel so a system-interrupted touch doesn't leave the timer armed to fire onLongPress spuriously.
  • Guarded the synthetic mouse events iOS fires after a touch (600ms window), so a touch long-press isn't followed by a phantom mouse tap that lets the tap action slip through.

Verification

Built clean; behavioral test:

Check Result
Mini play/pause → pauses audio, Now Playing stays closed
Tap mini card body → opens Now Playing
page errors none ✅

Long-press timing/gesture behavior is best confirmed on a real touchscreen; the hook logic is covered by review.

🤖 Generated with Claude Code


Generated by Claude Code

#6: the mini bar was a <button> that contained the play/next <button>s —
invalid nesting that browsers "fix up" unpredictably, breaking those taps on
iOS. Make the outer element a role="button" div (with Enter/Space keydown for
a11y); the inner controls stay real buttons.

#12: long-press was unreliable and leaky:
- onTouchMove cancelled on ANY movement, so normal finger jitter killed the
  hold ~half the time. Now it only cancels past a 10px tolerance.
- Added onTouchCancel so a system-interrupted touch doesn't leave the timer
  armed to fire onLongPress spuriously later.
- Guarded the synthetic mouse events iOS fires after a touch (600ms window) so
  a touch long-press isn't followed by a phantom mouse tap that lets the tap
  action slip through.

Verified in-browser: mini play/pause pauses without opening Now Playing, and
tapping the card body opens it; no console errors.

Fixes #6. Fixes #12.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkDKh1Uo1a4D7n5wCKdcKF
@EnesYilmazcode
EnesYilmazcode merged commit ad39cc8 into main Jul 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants