fix(videos): play overlay actually plays the video on click#450
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-nonediv, relying on the outer wrapper'sonClickto callvideo.play(). Clicks passed through to the<video>element underneath; the browser's default click-on-video handler briefly toggled state in a way that firedonPlay(hiding the overlay), but ended with the video still paused.Fix
<button>that captures the click and callsplay()directly.stopPropagation()keeps the wrapper out of it.play().then(..., () => {})— if the browser blocks autoplay, we don't fliphasPlayedso the overlay stays visible for the user to try again.onPauserestores the overlay when the video is att=0(e.g. failed to start), so the play affordance doesn't just vanish.Verification
Playwright walk against the chc/run-001 editor:
bun run test— 81 passed.bunx tsc -bclean.🤖 Generated with Claude Code