Skip to content

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

Closed

Description

@IgorA100

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

Activity

  1. adumesny commented on Mar 4, 2025

    @adumesny
    Member

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

  2. IgorA100 commented on Mar 4, 2025

    @IgorA100
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions