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 empty grid dimensions #6495

Closed
ruggi opened this issue Oct 8, 2024 · 0 comments · Fixed by #6496
Closed

trim dynamic empty grid dimensions #6495

ruggi opened this issue Oct 8, 2024 · 0 comments · Fixed by #6496
Assignees

Comments

@ruggi
Copy link
Contributor

ruggi commented Oct 8, 2024

No description provided.

@ruggi ruggi self-assigned this Oct 8, 2024
ruggi added a commit that referenced this issue Oct 8, 2024
…ate (#6496)

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

<img width="928" alt="Screenshot 2024-10-08 at 13 55 48"
src="https://github.com/user-attachments/assets/042ab509-8e82-4f7a-842c-cbb6a8ef7267">

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

<img width="928" alt="Screenshot 2024-10-08 at 14 00 03"
src="https://github.com/user-attachments/assets/9bd5d76c-9eae-406b-956d-f1f300b19ba7">


Fixes #6495
liady pushed a commit that referenced this issue Dec 13, 2024
…ate (#6496)

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

<img width="928" alt="Screenshot 2024-10-08 at 13 55 48"
src="https://github.com/user-attachments/assets/042ab509-8e82-4f7a-842c-cbb6a8ef7267">

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

<img width="928" alt="Screenshot 2024-10-08 at 14 00 03"
src="https://github.com/user-attachments/assets/9bd5d76c-9eae-406b-956d-f1f300b19ba7">


Fixes #6495
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 a pull request may close this issue.

1 participant