From abf8753fe61430122c9d3df40e559ecff3aef3c3 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Wed, 11 Mar 2026 14:27:40 +1100 Subject: [PATCH] fix(html): fix html container sizing (#881) --- packages/html/src/define/base.css | 25 +++++++++++ packages/html/src/define/skin-mixin.ts | 42 ++++--------------- packages/html/src/define/video/skin.ts | 2 +- .../sandbox/app/shared/html/stylesheets.ts | 2 +- packages/sandbox/package.json | 1 + .../sandbox/templates/html-hls-video/main.ts | 2 +- .../templates/html-simple-hls-video/main.ts | 2 +- .../templates/html-video-tailwind/main.ts | 2 +- packages/sandbox/templates/html-video/main.ts | 2 +- .../sandbox/templates/simple-hls-html/main.ts | 4 -- .../skins/src/default/css/components/root.css | 2 + .../src/default/tailwind/components/root.ts | 2 +- packages/skins/src/shared/native-captions.css | 26 ------------ pnpm-lock.yaml | 13 ++++++ .../installation/HTMLCdnCodeBlock.tsx | 8 ++++ 15 files changed, 65 insertions(+), 70 deletions(-) create mode 100644 packages/html/src/define/base.css delete mode 100644 packages/skins/src/shared/native-captions.css diff --git a/packages/html/src/define/base.css b/packages/html/src/define/base.css new file mode 100644 index 00000000..52f880c7 --- /dev/null +++ b/packages/html/src/define/base.css @@ -0,0 +1,25 @@ +video-player { + display: contents; +} + +video-player video, +video-player hls-video, +video-player simple-hls-video { + display: block; + width: 100%; + height: 100%; +} + +video-player video::-webkit-media-text-track-container { + transition: transform var(--media-caption-track-duration, 150ms) ease-out; + transition-delay: var(--media-caption-track-delay, 600ms); + transform: translateY(var(--media-caption-track-y, 0)) scale(0.98); + z-index: var(--media-caption-track-z, 1); + font-family: inherit; +} + +@media (prefers-reduced-motion: reduce) { + video-player video::-webkit-media-text-track-container { + transition-duration: 50ms; + } +} diff --git a/packages/html/src/define/skin-mixin.ts b/packages/html/src/define/skin-mixin.ts index 46835daa..81614dd6 100644 --- a/packages/html/src/define/skin-mixin.ts +++ b/packages/html/src/define/skin-mixin.ts @@ -1,37 +1,14 @@ import type { ReactiveElement } from '@videojs/element'; import type { Constructor } from '@videojs/utils/types'; +import styles from './base.css?inline'; -/** - * Light DOM stylesheet that bridges CSS custom properties set by skins - * to native WebKit text track pseudo-elements on the slotted `