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

[BUG] The order of the grids can break, when the page is loading on small screen, with Responsive Layouts #2584

Open
matyi15 opened this issue Dec 18, 2023 · 5 comments · Fixed by #2630
Labels

Comments

@matyi15
Copy link

matyi15 commented Dec 18, 2023

Subject of the issue

What the title says.
The order of the grids can break, when the page is loading on small screen, with Responsive Layouts.

Your environment

version of gridstack.js - 10.0.1
which browser/OS - Chrome/MacOS

Steps to reproduce

https://gridstackjs.com/demo/responsive_break.html

In the Responsive demos (either by column size or using breakpoints) if you reload the page when only one column should be displayed, than grid nr. 5 is placed before grid nr. 4. (But if you start from a bigger resolution, and zoom to the smallest, the order remains fine).

Expected behavior

The order should remain 1,2,3,4,5.

The bug is even more visible, if you change the items array a bit.
let items = [
{x:0,y:0,w:1,h:1},
{x:1,y:0,w:1,h:1},
{x:2,y:0,w:1,h:2},
{x:9,y:0,w:1,h:2},
{x:0,y:1,w:1,h:1},
{x:1,y:1,w:1,h:1},
{x:1,y:2,w:2,h:2}
];

@Cam-Bloom
Copy link

Also experiencing this problem in my app

@JakubEleniuk
Copy link
Contributor

Maybe there is a bug in checkDynamicColumn() ? The order is correct on initial load when commenting it out in the constructor, however loading after that still breaks the order.

@lopermo
Copy link

lopermo commented Mar 7, 2024

Have the same problem

@adumesny
Copy link
Member

adumesny commented Mar 7, 2024

ok, is someone wlling to donate to get this looked into ? I don't have the bandwidth to look at everything these days...

@NicolasCoelho
Copy link

Still happening in version 10.1.2. I think there is a bug in the _fixCollisions function. It calls moveNode function passing the variable collide to moveNode, but the real collided is the current node. Does it not must pass the current node instead the colided one? I changed to use nn instead the collide variable and it worked.
grid

@adumesny adumesny reopened this Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants