Skip to content

mouseTimeDisplay/timeTooltip hover preview never shows on touch-capable devices when using a mouse (vjs-touch-enabled is a static one-time check) #9224

Description

@nochev

Description

On touch-capable hardware (e.g. touchscreen laptops) that is actually being used with a real mouse or trackpad, hovering the seek bar never shows the built-in mouseTimeDisplay/timeTooltip hover preview. It only flashes briefly (matching the CSS's 1s transition) right after a drag/scrub ends.

This reproduces with a completely vanilla player. We ran into this building a sprite-thumbnail preview feature on top of video.js and ended up needing a workaround at the plugin level: phloxic/videojs-sprite-thumbnails#98

Reduced test case

https://codepen.io/editor/nochev-the-builder/pen/01a02fee-cadb-7e25-bc94-615037ef6bcb

Steps to reproduce

  1. Open this CodePen on a touch-capable device (e.g. a Windows 11 touchscreen laptop) using a mouse or trackpad, not the touchscreen itself.
  2. Click the player once to reveal the controls.
  3. Hover the seek bar without clicking - mouse time display is invisible.
  4. Now click-and-drag once along the seek bar (a real scrub), then release and hover again without clicking. Immediately after releasing, the preview flashes briefly, then disappears again.

Expected
Hovering the seek bar with a mouse/trackpad shows the time-preview tooltip, since a real mousemove is occurring.

Actual
The preview stays hidden except for a ~1s window right after a scrub/drag ends.

Root cause

video.js applies the vjs-touch-enabled class based on a static, one-time hardware capability check (navigator.maxTouchPoints/ontouchstart support), not on the input method currently being used. The default CSS then hides the hover preview whenever that class is present, unless the player is also vjs-scrubbing:

.video-js.vjs-touch-enabled:not(.vjs-scrubbing) .vjs-progress-control .vjs-mouse-display {
  visibility: hidden;
  opacity: 0;
  transition: visibility 1s, opacity 1s;
}

This correctly disables the preview for touch-only interactions (where persistent hover doesn't make sense), but it also disables it for genuine mouse/trackpad hover on any device that merely supports touch input, regardless of what's actually driving the pointer right now.

Suggested direction

Rather than gating this purely on the static touch-capability class, consider distinguishing it by the pointer/input type of the event actually driving the interaction (e.g. PointerEvent.pointerType), so mouse/trackpad hover on touch-capable hardware is not penalized for the device's hardware capabilities alone.

Errors

No response

What version of Video.js are you using?

8.23.6 (also observed on latest version)

Video.js plugins used.

No response

What browser(s) including version(s) does this occur with?

Chrome 151

What OS(es) and version(s) does this occur with?

Windows 11

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: triageThis issue needs to be reviewed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions