Fix sort order calculation
Sticky elements should be above non-sticky elements
This refs affinitic #5898