Avoid reflows via explicitly setting minRow #3054
Open
+6
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
If gridstack is used in a complex layout, the browser layout can be interrupted by a reflow when the
getComputedStyle
function is called to ask for parentmin-height
.To mitigate this in the
_updateContainerHeight
, it could be possible to give a priority if bothminRow
option and themin-height
CSS property of the parent div are set. In this way, applications that setsminRow
programmatically would never trigger the reflow.Since
0
is the default value, andnull
/undefined
values can be tricky to manage due to falsy/truly check in JS, to I would say that checking a non-zero/non-null value would be the solution. Users that wants "0" to be a valid row count and still disable the CSS check, could be pass something like-1
to obtain the same result.Thanks, L
Checklist
min-height
CSS prop, please let me know if you would like to have this tested)yarn test
)