Skip to content

fix(videos): play overlay actually plays the video on click#450

Merged
jjackson merged 1 commit into
mainfrom
fix/final-video-overlay-click
May 18, 2026
Merged

fix(videos): play overlay actually plays the video on click#450
jjackson merged 1 commit into
mainfrom
fix/final-video-overlay-click

Conversation

@jjackson
Copy link
Copy Markdown
Owner

Summary

@jjackson reported: "there is a play button on the main player at the top that doesn't work, you click it and then it goes away but then you still need to click the smaller play button on the lower left."

Cause: the play overlay was a pointer-events-none div, relying on the outer wrapper's onClick to call video.play(). Clicks passed through to the <video> element underneath; the browser's default click-on-video handler briefly toggled state in a way that fired onPlay (hiding the overlay), but ended with the video still paused.

Fix

  • Overlay is now a real <button> that captures the click and calls play() directly. stopPropagation() keeps the wrapper out of it.
  • play().then(..., () => {}) — if the browser blocks autoplay, we don't flip hasPlayed so the overlay stays visible for the user to try again.
  • onPause restores the overlay when the video is at t=0 (e.g. failed to start), so the play affordance doesn't just vanish.
  • Native lower-left controls still work independently.

Verification

Playwright walk against the chc/run-001 editor:

overlay visible before click: 1
after click: {'paused': False, 'currentTime': 0.753675, 'played': True}
overlay visible after click: 0

bun run test — 81 passed. bunx tsc -b clean.

🤖 Generated with Claude Code

The overlay div had `pointer-events-none` and relied on the wrapper's
onClick to call `play()`. Clicks passed through to the <video> element
underneath, the browser's default handler briefly toggled state in a
way that fired `onPlay` (hiding the overlay), but ended with the video
still paused — so the user had to click the native lower-left button
anyway. Reported by @jjackson: "you click it and then it goes away
but then you still need to click the smaller play button on the lower
left."

Fix: make the overlay a real <button> that captures the click itself,
calls `play()` directly, and stops propagation. The native controls
still work independently. Also restore the overlay if the video is
paused at t=0 (e.g. it failed to start) so the affordance doesn't
just vanish, leaving the user with a black box.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@jjackson jjackson merged commit d04d2de into main May 18, 2026
3 checks passed
@jjackson jjackson deleted the fix/final-video-overlay-click branch May 18, 2026 17:33
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