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

Limit block preview height. #24484

Closed
senadir opened this issue Aug 11, 2020 · 4 comments · Fixed by #24493
Closed

Limit block preview height. #24484

senadir opened this issue Aug 11, 2020 · 4 comments · Fixed by #24493
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Style Variations Related to style variations provided by block themes Good First Issue An issue that's suitable for someone looking to contribute for the first time

Comments

@senadir
Copy link
Contributor

senadir commented Aug 11, 2020

Currently, blocks previews are shown as is, with no limits, causing very large previews for certain blocks, we should consider limiting the height.

Examples:

  • Checkout block from the WooCommerce Blocks plugin (from a PR):
    image

  • A long reusable block
    image

To reproduce
Steps to reproduce the behavior:

  1. Create a long reusable block, containing several large blocks.
  2. Try to preview it.
  3. Notice that the block is taking the whole page.

Expected behavior
The block height should be limited

Screenshots

image

** Current workout **
Currently, I pass a isPreview attribute that adds .is-editor-preview, and I add some styles with it:

.is-editor-preview {
	max-height: 1000px;
	overflow: hidden;
	position: relative;
}

See this PR for examples.
Editor version (please complete the following information):

  • WordPress version: 5.4.2
  • Gutenberg version: 8.7

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Chrome
  • Version 84
@senadir senadir added [Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Style Variations Related to style variations provided by block themes CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Block Variations Block variations, including introducing new variations and variations as a feature labels Aug 11, 2020
@youknowriad youknowriad added Good First Issue An issue that's suitable for someone looking to contribute for the first time Needs Design Feedback Needs general design feedback. labels Aug 11, 2020
@youknowriad
Copy link
Contributor

I think for the style variations at least, having a max-height is probably a good idea.

@youknowriad youknowriad removed the [Feature] Block Variations Block variations, including introducing new variations and variations as a feature label Aug 11, 2020
aktasfatih added a commit to aktasfatih/gutenberg that referenced this issue Aug 11, 2020
Added a maximum height for the preview of large blocks
@MichaelArestad
Copy link
Contributor

I agree with limiting the height. I wonder if we can leverage vh units to make it a percentage of the viewport height. Perhaps something like calc(100vh - 84px). The second value is the height of the top toolbar plus 24px.

@MichaelArestad MichaelArestad removed the Needs Design Feedback Needs general design feedback. label Aug 11, 2020
@aktasfatih
Copy link
Member

I updated it to be as tall as the inserter minus the top position so it is symmetrical. Is this similar to what you have in mind?
This is what it looks like now,
download

@youknowriad
Copy link
Contributor

The vh works for the preview in the inserter but not for the style variations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Style Variations Related to style variations provided by block themes Good First Issue An issue that's suitable for someone looking to contribute for the first time
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants