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

HTML Preview not displaying correctly for some themes #13414

Closed
talldan opened this issue Jan 22, 2019 · 6 comments
Closed

HTML Preview not displaying correctly for some themes #13414

talldan opened this issue Jan 22, 2019 · 6 comments
Labels
[Block] HTML Affects the the HTML Block [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
Milestone

Comments

@talldan
Copy link
Contributor

talldan commented Jan 22, 2019

Describe the bug
This seems to be a regression introduced by #13080

For some themes (Twenty Seventeen, Twenty Sixteen, Twenty Fifteen) the Custom HTML block's preview is not displaying correctly:
screen shot 2019-01-22 at 12 01 16 pm

The cause seems to be that those themes have some styles on the body element that are now being included in the preview. In the case of Twenty Seventeen:

body {
    // ...
    margin: 20px 40px;
    // ...
}

This margin is causing the content to overflow the preview.

To Reproduce
Steps to reproduce the behavior:

  1. Activate Twenty Seventeen
  2. Create a custom html block with some basic content <div>test</div>
  3. Preview the classic block
  4. Observe that the content is not shown in the preview (or is clipped), but the preview does have an inner element with some scrollbars (due to the content overflow) and if you scroll around you'll find the content.

Expected behavior
The preview should be displayed clearly without the need to scroll.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context

  • reproduced with 4.9 release candidate 1
  • Twenty Nineteen doesn't seem to have this issue (it doesn't have the body margin)
@talldan talldan added [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release [Block] HTML Affects the the HTML Block labels Jan 22, 2019
@pento
Copy link
Member

pento commented Jan 22, 2019

As this is a regression in the packages that WordPress 5.1 has imported, I'm adding it to the WordPress 5.1 milestone.

@youknowriad
Copy link
Contributor

This is not a regression in 5.1 AFAIK.

@jasmussen
Copy link
Contributor

As a strawman idea: set body { margin: initial; }?

@youknowriad
Copy link
Contributor

Yes, I think we should reset margin and padding in the HTML block preview as these are only meant for the full editor styles.

@jasmussen
Copy link
Contributor

This is likely already partially done for style variation previews and block previews. Would it make sense to look into a mixin, or other way to semi-automate this?

@youknowriad
Copy link
Contributor

I don't think we can reuse things here as the styles must be applied inside the iframe (in JS)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] HTML Affects the the HTML Block [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

No branches or pull requests

4 participants