Skip to content

Incorrect calculation of block height when using "sizeToContent: true" and an image in an inner block without text. #2979

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

Closed
IgorA100 opened this issue Mar 4, 2025 · 2 comments

Comments

@IgorA100
Copy link

IgorA100 commented Mar 4, 2025

Subject of the issue

Incorrect calculation of block height when using "sizeToContent: true" and an image in an inner block without text.

Your environment

  • version of gridstack.js - 11.1.2 & 11.2.0 & 11.4.0
  • which Chrome, Chromium/Windows 8.1, 10

Steps to reproduce

https://jsfiddle.net/b50v4t87/

Expected behavior

The outer border of the block must match the size of the image regardless of "cellHeight"

Image
Image

@adumesny
Copy link
Member

adumesny commented Mar 4, 2025

not a bug. sizeToContent: true means make cell tall enough to fit content - you are still bound to cellHeight (which defaults to auto = square).

@IgorA100
Copy link
Author

IgorA100 commented Mar 4, 2025

you are still bound to cellHeight

OK, but cellHeight can't actually work with small px values ​​now. And to avoid empty space, you need to specify cellHeight: 1px
#2978

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants