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

[css-grid-3] The initial value of masonry-slack should be 0 #10882

Open
Loirooriol opened this issue Sep 12, 2024 · 4 comments
Open

[css-grid-3] The initial value of masonry-slack should be 0 #10882

Loirooriol opened this issue Sep 12, 2024 · 4 comments

Comments

@Loirooriol
Copy link
Contributor

https://drafts.csswg.org/css-grid-3/#masonry-slack says that the initial is masonry-slack: 1em.

I think that the correct masonry-slack slack value is very dependent on the contents of the masonry, so 1em may not work well in some cases, and will probably just cause unnecessary confusion to authors.

I think it's better to default to 0, and then let authors choose what works best for them.

@fantasai
Copy link
Collaborator

I disagree, because of I think the default should be something that generally works well: and I suspect there are very, very few use cases where a value less than 1em would be appropriate.

It's also easier to understand that there's a value you can tweak here when it isn't zero: the behavior is already there, so you go looking for the knob rather than assuming there isn't one.

1em isn't particularly arbitrary; we use it for column-gap. The one change that might make sense is switching it to 1lh since it's a block-axis adjustment.

@tabatkins
Copy link
Member

Yeah, a 1px difference between two columns should definitely not cause the masonry items to be misordered by default; that would just be a bad default behavior. We can discuss exactly what value the default should be, but it should definitely be something non-zero but fairly small, approximately 1em.

@jensimmons
Copy link
Contributor

I really like the idea of 1lh as the default.

I agree that's about the right amount — it's kind of the smallest visible difference. And of course, authors can change it.

Maybe we want to do 1em for the sake of consistency, since that measurement is the default in a lot of places (paragraph margins, for instance). But I really like 1lh. That is what would have been used all over, if the unit had existed decades ago.

@Loirooriol
Copy link
Contributor Author

a 1px difference between two columns should definitely not cause the masonry items to be misordered by default

I have tested desandro's Masonry and Macy.js, and both definitely do that by default. I didn't even see an option to change this, so it doesn't seem something authors expect or are asking for (unlike #10883 btw).

While I agree that using some positive value is desirable in most cases, I'm not convinced that the confusion that it may cause if we set 1em by default is a net gain.

we use it for column-gap

Yeah I guess that's a good point, though.

I really like the idea of 1lh as the default.

I don't see 1lh as a particularly better choice than 1em, it seems to me that masonry is typically used for image galleries where the height of a text line isn't much relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment