Skip to content

Set the scale() CSS property to the proper element for block pattern preview.#38543

Closed
ixkaito wants to merge 1 commit intoWordPress:trunkfrom
ixkaito:improve/set-scale-to-the-proper-element
Closed

Set the scale() CSS property to the proper element for block pattern preview.#38543
ixkaito wants to merge 1 commit intoWordPress:trunkfrom
ixkaito:improve/set-scale-to-the-proper-element

Conversation

@ixkaito
Copy link
Copy Markdown
Contributor

@ixkaito ixkaito commented Feb 5, 2022

Description

Set the scale() CSS property to the proper element for block pattern preview.

Testing Instructions

Screenshots

Before and after

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).
  • I've updated related schemas if appropriate.

@ixkaito ixkaito requested a review from ellatrix as a code owner February 5, 2022 10:45
@ixkaito ixkaito mentioned this pull request Feb 5, 2022
8 tasks
@jasmussen jasmussen requested review from a team and noahtallen and removed request for a team February 8, 2022 08:31
@draganescu
Copy link
Copy Markdown
Contributor

I tested this but it's unclear to me what should happen with this changeset applied. I tested in Safari and preview__content seems to be the same in trunk.

@ixkaito
Copy link
Copy Markdown
Contributor Author

ixkaito commented Feb 8, 2022

There's no change on the screen because .block-editor-block-preview__content has an initial value visible for overflow, so its content is visible now. However, .block-editor-block-preview__content has a wrong size. Please check the size of .block-editor-block-preview__content in your browser inspector. It has 0px width and a smaller height than it's content. If you set overflow: hidden; to .block-editor-block-preview__content, its content will be invisible.

Why this is happening: For example, contentHeight is 100, and scale is 0.1. The height of .block-editor-block-preview__content would be 1px because the height is 100 * 0.1 and then transformed by scale(0.1), but it shouldn't. It should be 10px. What we have to scale is not the parent container but the child iframe.

@Mamaduka
Copy link
Copy Markdown
Member

Mamaduka commented Jan 8, 2025

I believe issues with Block Previews have been resolved, and we can close this PR.

Thanks again for contributing, @ixkaito!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 8, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ixkaito <ixkaito@git.wordpress.org>
Co-authored-by: draganescu <andraganescu@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@noahtallen noahtallen removed their request for review January 9, 2025 20:05
@Mamaduka Mamaduka closed this Apr 7, 2025
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