feat(packages): remove native controls after mounting our controls#1727
feat(packages): remove native controls after mounting our controls#1727sampotts wants to merge 1 commit into
Conversation
✅ Deploy Preview for vjs10-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📦 Bundle Size Report🎨 @videojs/html
Presets (7)
Media (10)
Players (5)
Skins (30)
UI Components (38)
Sizes are marginal over the root entry point. ⚛️ @videojs/react — no changesPresets (7)
Media (9)
Skins (27)
UI Components (32)
Sizes are marginal over the root entry point. 🧩 @videojs/core — no changesEntries (14)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (10)
📦 @videojs/spf — no changesEntries (4)
ℹ️ How to interpretJS sizes are initial static graph totals (minified + brotli). Lazy dynamic chunks are shown separately when present.
Run |
f22d815 to
3c90967
Compare
| if (hasMediaChanged || hasContainerChanged) { | ||
| this.#detachStore(); | ||
| this.#detach = store.attach(target); | ||
| if (isMediaControlsCapable(target.media) && target.media.controls) target.media.controls = false; |
There was a problem hiding this comment.
I read the issue but I find it slightly presumptuous. what if the user does want to use the native controls for some reason.
There was a problem hiding this comment.
I can see that but at the same time I think it'd be unlikely someone has both provided custom controls and wants native controls?
There was a problem hiding this comment.
I'd have preferred to add the native controls removal logic to our controls component but we don't actually have one (it's just a <div>) so we'd have to add a <media-controls> / <Controls> component, which would obviously add a tiny bit more to the bundle.
There was a problem hiding this comment.
We do have controls components?
There was a problem hiding this comment.
"You're absolutely right!"
I don't know why we're not using them currently in the skins (probably an oversight on my part way back) but I'll update and put the logic there instead.
3c90967 to
c6eceee
Compare
|
I've changed it to be based on mounting of our custom controls instead of the container. This would allow consumers to use native controls if they wanted to. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c6eceee. Configure here.
c6eceee to
1415071
Compare
|
Going to close this out as |

Summary
Remove the native controls after mounting our custom controls component. This allows for progressive enhancement and has been noted in the migration docs.
Given it affects skins, I won't merge until @mihar-22 gives it the ok.
Closes #1160
Note
Medium Risk
Touches core player attach lifecycle and mutates native
controlson media elements across HTML and React; behavior is covered by new tests but regressions could affect fallback playback without custom UI.Overview
Enables progressive enhancement: media can ship with native
controlsuntil a custom controls UI mounts, then native controls are turned off and restored if all custom controls unmount.A new controls registration path tracks mounted control roots (HTML
media-controlsvia player context; ReactControls.RootviaregisterControls/controlsMounted). The provider mixin and React provider useisMediaControlsCapableto setmedia.controls = falseonly while at least one controls instance is registered, with refcounting when multiple roots exist.Skins and presets wrap control chrome in
media-controls/Controls.Rootinstead of plain divs, anddefineControls()is wired into audio/live-audio UI registration. ReactVideo/Audioomit thecontrolsattribute whencontrolsMountedis true.Reviewed by Cursor Bugbot for commit 1415071. Bugbot is set up for automated code reviews on this repo. Configure here.