fix(packages): prevent controls click triggering interactions - #1885
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 — no changesPresets (7)
Media (10)
Players (5)
Skins (30)
UI Components (39)
Sizes are marginal over the root entry point. ⚛️ @videojs/react — no changesPresets (7)
Media (9)
Skins (27)
UI Components (33)
Sizes are marginal over the root entry point. 🧩 @videojs/core — no changesEntries (72)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (12)
📦 @videojs/media — no changesEntries (14)
📦 @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 |
cjpillsbury
left a comment
There was a problem hiding this comment.
Approved with a couple of suggestions (one non-blocking/as a followup)
| override connectedCallback(): void { | ||
| super.connectedCallback(); | ||
|
|
||
| this.setAttribute('data-interactive', ''); |
There was a problem hiding this comment.
thought(non-blocking): this should not block merging/releasing imo, but, as a followup, we may want to consider another attribute or a different name, since this name is kind of "lying." These components aren't interactive. If anything, we're trying to identify them to disable a gesture-based interaction.
There was a problem hiding this comment.
I guess it's more "contains interactive" since it tells the gesture logic to ignore interactions from this element but yeah, we can rename it.
| stateAttrMap: ControlsDataAttrs, | ||
| ref: [forwardedRef], | ||
| props: [{ children }, elementProps], | ||
| props: [{ children }, elementProps, { 'data-interactive': '' }], |
There was a problem hiding this comment.
suggestion(non-blocking): We may want to switch the order of elementProps and { 'data-interactive': '' } here so that folks could override the default (I think?)?
There was a problem hiding this comment.
Would we want them to allow the interactions with the controls container to trigger gestures? I mean I guess we could 🤔
Add the
data-interactiveescape hatch the controls container, preventing clicks from triggering any click interactions bound to the main container.Note
Low Risk
Small, targeted DOM attribute change with tests; affects gesture hit-testing only, not playback or auth.
Overview
Clicks on the controls bar (not just individual buttons or sliders) were still bubbling into the player’s container tap gesture and could toggle play/pause. This PR marks the whole controls root as an interactive surface so those pointer events are ignored by container gestures.
HTML
ControlsElementsetsdata-interactiveinconnectedCallback. ReactControlsRootpasses the same attribute on its rootdiv. Unit tests cover both implementations, core gesture behavior for descendants inside adata-interactiveancestor, and e2e tests for HTML and React verify pointer events on the controls container do not change playback state.Reviewed by Cursor Bugbot for commit d3be0a2. Bugbot is set up for automated code reviews on this repo. Configure here.