Skip to content

Conversation

@distantnative
Copy link
Member

@distantnative distantnative commented Jul 11, 2025

Description

This PR improves drag'n'drop sorting of k-items for list layout: Instead of positioning the sort handle absolute outside of the k-items boundaries, it is now positioned relatively inside the container. This is necessary as SortableJS gets tripped up by the absolute positioning outside. To achieve the same look/style as before, a new .k-item-wrapper div was added and the main styles applied to this.

Changelog

Fixes

Breaking changes

  • DOM structure of k-item has been changes. An additional wrapper .k-item-box div was added.

For review team

  • Add lab and/or sandbox examples (wherever helpful)
  • Add changes & docs to release notes draft in Notion

@distantnative distantnative added this to the 5.1.0 milestone Jul 11, 2025
@distantnative distantnative self-assigned this Jul 11, 2025
@distantnative distantnative linked an issue Jul 11, 2025 that may be closed by this pull request
@distantnative distantnative requested a review from a team July 11, 2025 03:32
@distantnative distantnative changed the title Fix/items sortable fix: More reliable sorting of k-items Jul 11, 2025
@bastianallgeier
Copy link
Member

This is the kind of change where I wonder if we would actually need to call it "breaking". At least in terms of the markup and CSS for items. Unfortunately the items are so dominant in the panel that I can see how this could be an issue.

@distantnative
Copy link
Member Author

distantnative commented Jul 14, 2025

I totally understand that point. At the same time I am not sure we can leave sorting pretty broken in the list layout for all of v5.

@bastianallgeier
Copy link
Member

I tried a couple more things to get this done via a CSS-only solution, but it all feels like a hack. I think your solution really is the most stable one. It's nitpicky, but maybe we can find a better name for the wrapper? Something like k-item-box maybe?

@distantnative
Copy link
Member Author

I just saw a comment on the sortablejs repo that position absolute would work as long as the same z-index. Maybe we could try that.

Otherwise, open to any name for the new div .

@distantnative
Copy link
Member Author

Nevermind, that was also only true when the handle is placed absolute but inside the parent. So I think we really have to restructure it like in this PR. But not sure if in v5.x or v6.

@distantnative distantnative changed the base branch from develop-minor to v6/develop July 16, 2025 08:53
@distantnative distantnative changed the base branch from v6/develop to develop-minor July 16, 2025 08:54
@bastianallgeier
Copy link
Member

Can we maybe split the PR? All your non-destructive changes to the items component could be immediately merged and I think they already help to fix a few things. With the other parts, we might think again if there's a CSS-only solution for v5 and then a more drastic solution for v6?

@distantnative distantnative modified the milestones: 5.1.0, 6.0.0-alpha.1 Jul 16, 2025
@distantnative distantnative changed the title fix: More reliable sorting of k-items fix!: More reliable sorting of k-item Jul 16, 2025
@distantnative distantnative changed the title fix!: More reliable sorting of k-item fix: Place sort handle inside k-item boundaries Jul 16, 2025
@distantnative distantnative changed the base branch from develop-minor to v6/develop July 16, 2025 09:49
@distantnative distantnative marked this pull request as draft July 16, 2025 09:50
@distantnative distantnative changed the title fix: Place sort handle inside k-item boundaries fix!: Place sort handle inside k-item boundaries Jul 16, 2025
@distantnative distantnative force-pushed the fix/items-sortable branch 2 times, most recently from 2bfe119 to 656a835 Compare July 17, 2025 10:43
@distantnative distantnative marked this pull request as ready for review July 17, 2025 10:43
Fixes #7349

BREAKING CHANGE: DOM structure of `k-item` has been changes. An additional wrapper `.k-item-box` div was added.
@bastianallgeier
Copy link
Member

@distantnative I think you can resolve the conflicts better than me, but the PR definitely looks good.

@distantnative
Copy link
Member Author

@bastianallgeier I will wait for the multi-select PR first, to not have to do it twice.

@distantnative distantnative marked this pull request as draft August 18, 2025 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Problem changing order of page list items in panel

3 participants