Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vjs-styles-defaults override defaults and cause page reflow #2867

Closed
hartman opened this issue Dec 1, 2015 · 2 comments
Closed

vjs-styles-defaults override defaults and cause page reflow #2867

hartman opened this issue Dec 1, 2015 · 2 comments

Comments

@hartman
Copy link
Contributor

hartman commented Dec 1, 2015

I'm using videojs to progressively enhance my video elements. Unfortunately this is causing significant page reflows, which will impact the render speed of my pages. A requirement for these problems is to asynchronously load your javascript.

  • Problem one is that the video-js containers switch my players from inline-block to block. This causes page reflows for inlined elements. I can reset this in my own CSS, but I shouldn't have to.
  • Second problem is vertical-alignment: top, which causes a redraw for inline elements. I can reset this in my own CSS, but I shouldn't have to.
  • Third problem is the default size. This has higher specificity then my elements attributes. This is a problem, because the time by which my CSS is loaded and the defaults get applied to

This last one is really annoying to workaround. I cannot reset these defaults to 'initial' with pure CSS, because the per player classes with the correct w/h (which are added much later during player initialization), wouldn't have high enough specificity anymore. So really the only way to fix this is by using an inline style attribute and then after videojs setup remove that style attribute, which is... less then desirable.

There has to be a better way to deal with this... I'm reserving this space in my canvas for a reason (exactly to prevent reflows of the layout). To have the wrapping div ignore my original wish seems stupid. It this only to accommodate those who forget to reserve canvas area using the HTML attributes? In that case, why not set these fallback values as the last step of the players initialization, in case nothing else has set a width/height.

@hartman
Copy link
Contributor Author

hartman commented Dec 8, 2015

Rolling a private patch for now to counter this:
https://phabricator.wikimedia.org/diffusion/ETMH/browse/master/patches/videojs.defaults.patch

@gkatsev
Copy link
Member

gkatsev commented Feb 8, 2016

Going to close this a duplicate of #3051 just because it currently has the action item. It should be fixed as part of that.

@gkatsev gkatsev closed this as completed Feb 8, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants