Skip to content

fix(app): correct 1px video shift on desktop Safari too (#813) - #1813

Open
johan-bell wants to merge 1 commit into
mainfrom
813-app-video-player-shift-safari-web
Open

fix(app): correct 1px video shift on desktop Safari too (#813)#1813
johan-bell wants to merge 1 commit into
mainfrom
813-app-video-player-shift-safari-web

Conversation

@johan-bell

Copy link
Copy Markdown
Collaborator

Re-opens #813 — the 1px downward video shift is back on desktop (macOS) Safari.

Problem

.video-player is absolutely positioned, and Safari renders the video 1px lower than that container — a 1px gap at the top and an overhang at the bottom. This affects Safari on both macOS and iOS, but not Chrome/Firefox.

The existing correction was gated behind @supports (-webkit-touch-callout: none), which only matches iOS-webkit-touch-callout isn't supported by desktop macOS Safari, so the −1px correction never applied there. That's the "safari web" case in the screenshot on the issue.

Fix

Drive the correction off the platform, not a CSS feature query. The component sets an isSafariRendering flag from video.js's own browser detection (videojs.browser.IS_SAFARI || IS_IOS) — the same source already used for nativeAudioTracks — and toggles a .safari-shift-fix class. The CSS applies transform: translateY(-1px) to that class.

This covers desktop macOS Safari and iOS, and excludes Chrome/Firefox (which don't have the shift, so they must not be nudged).

Tests

  • VideoPlayer.spec.ts: 12/12. type-check + eslint clean.

⚠️ Not verified on Safari

This is a Safari-specific rendering fix and I can't drive macOS/iOS Safari in this environment, so it's verified by reasoning + the existing unit suite, not visually on Safari. Worth a 10-second look before merge: open a video in desktop Safari and confirm the 1px gap/overhang is gone, and in Chrome confirm nothing moved (no new 1px misalignment). videojs.browser.IS_SAFARI is the same detection the player already trusts, so the risk is low — but low isn't verified.

The video renders 1px lower than its absolutely-positioned container on Safari,
leaving a 1px gap at the top and an overhang at the bottom. This happens on
Safari on both macOS and iOS, but not on Chrome/Firefox.

Apply the -1px correction via a `.safari-shift-fix` class toggled from the
component using video.js's browser detection (IS_SAFARI || IS_IOS) — the same
source already used for nativeAudioTracks — so it covers desktop macOS Safari,
not only iOS.
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