Skip to content

Double click to full screen on video#15453

Open
abeddow91 wants to merge 4 commits intoab/full-screen-spikefrom
ab/full-screen-double-click
Open

Double click to full screen on video#15453
abeddow91 wants to merge 4 commits intoab/full-screen-spikefrom
ab/full-screen-double-click

Conversation

@abeddow91
Copy link
Contributor

@abeddow91 abeddow91 commented Mar 2, 2026

What does this change?

Adds the ability to double-click on a video to go to fullscreen. This is currently guarded so that this functionality only works on self hosted default videos, not loops or cinemagraphs. This works by using reacts onDoubleClick handler to call handleFullscreenClick.

Why does this require a delay to play/pause?

clicks are registered as click -> click -> double click. This means our existing single-click play/pause handler would fire twice before the dblclick event is emitted (eg pause -> play -> fullscreen).

To prevent this, a 250ms delay has been introduced to the single-click play/pause handler. 250ms is roughly the threshold for a double click.

How it works

On first click start a 250ms timer.

  1. If a second click occurs within that window:
  • The timer is cancelled.
  • Play/pause is never triggered.
  • The onDoubleClick handler runs and enters fullscreen.
  1. If no second click occurs:
  • The timer completes.
  • Play/pause executes as normal.

Why?

This aligns the video experience more closely with common desktop video player behaviour (e.g. YouTube).

Screenshots

Without the delay to single click

fullscreen-no-delay.mov

With the delay to single click

fullscreen-delay.mov

Running Chromatic

In order to run Chromatic as part of the CI checks, you will need to add the run_chromatic label to your PR. Once the label is added Chromatic will run on every push.

Please only add this once you are ready to check for visual regressions, our intention here is to reduce the amount of time Chromatic is run without being looked at.
-->

…llscreen.

Why have a delay?
This is to prevent play/pause toggling when the user double-clicks. A double-click fires as: click -> click -> dblclick, so without the delay the video would toggle play/pause twice before the dblclick handler fires. The 250ms delay roughly matches the system double-click threshold, giving the dblclick handler enough time to cancel the pending single-click.
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

@abeddow91 abeddow91 changed the title ull screen double click Double click to full screen on video Mar 2, 2026
@abeddow91 abeddow91 self-assigned this Mar 2, 2026
@abeddow91 abeddow91 requested a review from domlander March 2, 2026 09:36
@abeddow91 abeddow91 added feature Departmental tracking: work on a new feature fronts + curation run_chromatic Runs chromatic when label is applied labels Mar 2, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Mar 2, 2026
@paperboyo
Copy link
Contributor

Yay! Thank you!

I don’t have strong feelings about the delay. Just looking at Youtube and videojs, I think they just fire off extra pause+play events (Youtube is even flashing all them play+pause icons!)?

It may be safest to go with the majority? Although I can’t tell how annoying (if even!) is the delay for those who just want to pause/play…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature fronts + curation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants