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][masonry] Drop next value of masonry-auto-flow#10232

Open
fantasai opened this issue Apr 19, 2024 · 3 comments
Open

[css-grid-3][masonry] Drop next value of masonry-auto-flow #10232

fantasai opened this issue Apr 19, 2024 · 3 comments

Comments

@fantasai
Copy link
Collaborator

This value seems to cause problems with accessibility except in cases where the sizes of items are very close; and those cases are probably better handled by the masonry-threshold idea (see #9328 ).

@Loirooriol
Copy link
Contributor

I disagree, as I explained in #9988.

This value seems to cause problems with accessibility

Please explain these problems. Sure, items close in document order can appear far away. But this can already happen with order, multicol, etc.

those cases are probably better handled by the masonry-threshold idea

I disagree. next brings stability, if you use it you can be sure that a small change in the size of a grid item will not completely rearrange all the following items in a chaotic way. masonry-threshold doesn't achieve that, it just changes the threshold at which things will shuffle.

Also note that next is a feature exposed in multiple masonry libraries:

And it's requested by authors: #10233 (comment)

@fantasai
Copy link
Collaborator Author

I disagree. next brings stability, if you use it you can be sure that a small change in the size of a grid item will not completely rearrange all the following items in a chaotic way. masonry-threshold doesn't achieve that, it just changes the threshold at which things will shuffle.

I don't understand your objection. masonry-threshold will get you the behavior of 'next' except in cases where the "change in size" isn't actually "small". It basically lets you choose the size at which the change in size it's no longer considered a "small". (If you set it to infinity, it gets you exactly the behavior of next.)

The problem with 'next' is that if you have a wide variation in sizes, e.g. some items 3x as tall as others, you will get the items stacking in very uncomfortable ways to follow sequentially.

@Loirooriol
Copy link
Contributor

will get you the behavior of 'next' except in cases where the "change in size" isn't actually "small"

Consider a threshold of 10px. If we have three columns filled with 100px, 90px, 80px, then the next item will go into the 2nd column.
But if the last item placed in that column becomes 0.1px larger, resulting in columns filled with 100px, 90.1px, 80px, then we would place the next item into the 3rd column. And from that point on, things can change radically.

If you set it to infinity, it gets you exactly the behavior of next

That doesn't seem to follow from the definition in #9328: "among all the columns within slack distance of the shortest column, place in the startmost"

The 1st column will always be within an infinity distance from the shortest column, so all items will go into the 1st column.

I guess the logic could be modified to:

  1. Let x be the last column that received an item, if any.
  2. If there is no x, pick the first column and abort these steps.
  3. Find the candidate columns within the threshold from the shortest one.
  4. Pick the startmost candidate column that comes after x and abort these steps, if any.
  5. Otherwise, pick the startmost candidate column.

I think that would really be the next behavior. Then I would be fine with dropping masonry-auto-flow: next. But masonry-threshold: calc(1px / 0) seems quite hacky, I would prefer to add a keyword for it.

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

No branches or pull requests

2 participants