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

Update: Keep ratio on cover video backgrounds #11886

Merged

Conversation

jorgefilipecosta
Copy link
Member

@jorgefilipecosta jorgefilipecosta commented Nov 15, 2018

Description

This PR updates cover block to use object-fit cover instead of object-fit fill for the video background.
This change will make sure the ratio of the video is always kept.
The downside is that part of the video may be cropped to make sure it fills the background, and its ratio is kept.

How has this been tested?

Verify the cover block still works as before.
Verify the ratio of the video is always kept (by resizing the window) in the frontend and it the editor.

Screenshots

After:
nov-15-2018 00-02-22
Before:
nov-15-2018 00-07-48

@jorgefilipecosta jorgefilipecosta added [Type] Enhancement A suggestion for improvement. [Block] Cover Affects the Cover Block - used to display content laid over a background image labels Nov 15, 2018
@jorgefilipecosta jorgefilipecosta changed the title Update: Keep ratio on cover video backgrounds. Update: Keep ratio on cover video backgrounds Nov 15, 2018
@jorgefilipecosta jorgefilipecosta added this to the 4.4 milestone Nov 15, 2018
@@ -10,6 +10,7 @@
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed for both image and video?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only needed for the videos. But it does not affect the images or changes anything if also applied to images. We don't have a way in CSS to target a class if it contains a specific child e.g: a video, so I applied to both images and video.

@youknowriad youknowriad modified the milestones: 4.4, 4.5 Nov 15, 2018
@mtias mtias modified the milestones: 4.5, 4.4 Nov 15, 2018
@mtias mtias added the Needs Design Feedback Needs general design feedback. label Nov 15, 2018
@karmatosed karmatosed self-requested a review November 15, 2018 14:45
@karmatosed
Copy link
Member

This to me makes sense. My only wonder is cross browser support but a cautious look seems 👍

@karmatosed karmatosed removed the Needs Design Feedback Needs general design feedback. label Nov 15, 2018
@jasmussen
Copy link
Contributor

This works for me in my testing. I can confirm that the aspect ratio before was skewed, and it isn't anymore. The extra crop is fine.

I was concerned the added overflow rule would make the sticky toolbars not work — it has done so in the past. But the sticky toolbar works fine here, so the scope for the rule is good.

👍 👍

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@jorgefilipecosta jorgefilipecosta merged commit e2d08a4 into master Nov 15, 2018
@jorgefilipecosta jorgefilipecosta deleted the update/keep-ratio-on-cover-video-backgrounds branch November 15, 2018 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants