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

Trim dynamic grids' collapsed extra rows/cols from the computed template #6496

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

ruggi
Copy link
Contributor

@ruggi ruggi commented Oct 8, 2024

Problem:

In grid templates when using repeat functions and auto-fit/auto-fill, the computed style might contain extra rows/cols, collapsed to a 0px 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.

Screenshot 2024-10-08 at 13 55 48

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).

Screenshot 2024-10-08 at 14 00 03

Fixes #6495

Copy link
Contributor

github-actions bot commented Oct 8, 2024

Try me

Copy link

relativeci bot commented Oct 8, 2024

#14639 Bundle Size — 57.74MiB (~+0.01%).

bee4923(current) vs 916e8b9 master#14635(baseline)

Warning

Bundle contains 70 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Regression 1 regression
                 Current
#14639
     Baseline
#14635
Regression  Initial JS 40.74MiB(~+0.01%) 40.74MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 17.97% 18.24%
No change  Chunks 21 21
No change  Assets 23 23
No change  Modules 4113 4113
No change  Duplicate Modules 213 213
No change  Duplicate Code 27.41% 27.41%
No change  Packages 475 475
No change  Duplicate Packages 70 70
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
#14639
     Baseline
#14635
Regression  JS 57.73MiB (~+0.01%) 57.73MiB
Improvement  HTML 7.37KiB (-0.25%) 7.39KiB

Bundle analysis reportBranch fix/trim-dynamic-empty-grid-dimsProject dashboard


Generated by RelativeCIDocumentationReport issue

@ruggi ruggi merged commit 0724d87 into master Oct 8, 2024
15 checks passed
@ruggi ruggi deleted the fix/trim-dynamic-empty-grid-dims branch October 8, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

trim dynamic empty grid dimensions
3 participants