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

Add array sort compareFunction to keep items respective DOM order in Firefox #1617

Merged
merged 1 commit into from
Feb 12, 2021
Merged

Add array sort compareFunction to keep items respective DOM order in Firefox #1617

merged 1 commit into from
Feb 12, 2021

Conversation

marcel-necker
Copy link
Contributor

Description

grid-stack-items does not keep their respective DOM order if x,y declarations are missing (autoPosition) in Firefox.
The array sort order is implementation-defined if their is not a consistent comparison function for the elements of items:
https://tc39.es/ecma262/#sec-array.prototype.sort

Following simple example shows an reversed order of the grid-stack-items in Firefox than they appear in the DOM:
https://jsbin.com/yitiputuqe/1/edit?html,output

Checklist

  • Created tests which fail without the change (if possible)
  • All tests passing (yarn test)
  • Extended the README / documentation, if necessary

@adumesny adumesny merged commit fcccfb1 into gridstack:develop Feb 12, 2021
@adumesny
Copy link
Member

thank you for the fix and example! didn't know FF needed a compare... I'll update the readme.

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.

2 participants