Trim dynamic grids' collapsed extra rows/cols from the computed template #6496
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.
Problem:
In grid templates when using
repeat
functions andauto-fit
/auto-fill
, the computed style might contain extra rows/cols, collapsed to a0px
size. Normally this is not an issue, but since for dynamic templates we display the grid wireframe based on the computed dimensions, those extra dimensions would appear visible on the canvas as zombies. This behavior of appending extra collapsed tracks is explained in https://www.w3.org/TR/css-grid-1/#repeat-notation.Fix:
When parsing the templates, first parse the
fromProps
template.Then, after parsing the computed template, if the
fromProps
template it contains dynamic tracks, trim any dangling collapsed elements in the computed template dimensions array.This is not necessarily optimal (if you have an explicit
0px
sized column in your template, it will be hidden from the canvas), but concretely it will do "the right thing" and you can always use the inspector to target any 0-sized cols/rows (which you would have to do anyways).Fixes #6495