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

Fix aspect ratio typo and recalculate padding in embed block CSS #16573

Merged
merged 2 commits into from
Jul 26, 2019
Merged

Fix aspect ratio typo and recalculate padding in embed block CSS #16573

merged 2 commits into from
Jul 26, 2019

Conversation

gregsullivan
Copy link
Contributor

Description

As discussed with @jasmussen here, there is a typo in the selector for the 9:16 aspect ratio. The ratio is listed accurately here:

// Add responsiveness to common aspect ratios.
&.wp-embed-aspect-21-9 .wp-block-embed__wrapper,
&.wp-embed-aspect-18-9 .wp-block-embed__wrapper,
&.wp-embed-aspect-16-9 .wp-block-embed__wrapper,
&.wp-embed-aspect-4-3 .wp-block-embed__wrapper,
&.wp-embed-aspect-1-1 .wp-block-embed__wrapper,
&.wp-embed-aspect-9-16 .wp-block-embed__wrapper,
&.wp-embed-aspect-1-2 .wp-block-embed__wrapper {

But here it has been changed to 9:6:

&.wp-embed-aspect-9-6 .wp-block-embed__wrapper::before {
padding-top: 66.66%; // 6 / 9 * 100
}

Given that aspect ratios are sorted in ascending order by the required top padding, it appears the second code excerpt should be:

&.wp-embed-aspect-9-16 .wp-block-embed__wrapper::before {
	padding-top: 177.77%; // 16 / 9 * 100
}

This pull request fixes the typo and recalculates the value for padding-top.

I considered whether the intention could be to use 9:6 as an aspect ratio in addition to 9:16, but presumably that would have been listed as 3:2, so I believe 9:16 was the intended aspect ratio all along.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

Second decimal place should be rounded up (to match values in ASPECT_RATIOS constant)
@youknowriad youknowriad merged commit 2e43198 into WordPress:master Jul 26, 2019
@youknowriad
Copy link
Contributor

Thanks for the fix 🎉

@github-actions github-actions bot added this to the Gutenberg 6.2 milestone Jul 26, 2019
@gregsullivan gregsullivan deleted the update/embed-aspect-ratios branch July 26, 2019 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants