[listbox] Add sorting providers using the drag engine - #3
Open
flaviendelangle wants to merge 25 commits into
Open
flaviendelangle wants to merge 25 commits into
flaviendelangle wants to merge 25 commits into
Conversation
flaviendelangle
force-pushed
the
listbox-base-ui-dnd
branch
from
August 14, 2026 10:47
b94fd12 to
09232bb
Compare
flaviendelangle
force-pushed
the
listbox-base-ui-dnd
branch
from
August 14, 2026 11:32
09232bb to
95146d8
Compare
# Conflicts: # docs/src/error-codes.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This builds on Michal's original Listbox PR, replacing its Pragmatic DnD integration with the Base UI drag engine and aligning sorting and external-drop APIs with Tree.
The PR targets
listbox-drag-engine-base, which combines the Listbox and drag-engine parent branches. Their unrelated changes are excluded from this diff.Changes compared with the original Listbox implementation:
DragAndDropProviderwithKeyboardSortableProviderfor keyboard-only sorting andSortableProviderfor keyboard and pointer sorting. Ordinary items and keyboard-only sorting do not import the pointer drag implementation. Remove the Pragmatic DnD dependencies and Listbox-specific registration hook.onItemsReorder(values, eventDetails). It proposes the complete order, supports cancellation, reports keyboard or drag reasons, and includes group membership ineventDetails.order. Applications accept a move by rendering the proposed order; focus and announcements follow the accepted update.canMoveItemsandisItemSortingDisabledfor shared keyboard and pointer restrictions. Sorting can be disabled without disabling selection. Movement metadata exposes item IDs, values, indices, and group IDs; disabled state stays internal.reorderOn="move"alongside the default drop-time reordering. Cancellation restores the previous order when it does not conflict with external reorders, while preserving item edits, deletions, and newly inserted items. Transaction helpers handle deferred updates, unmounting, and conflicting external reorders. Accepted external drops restore any live sorting preview before the application performs the transfer.ItemExternalDropTarget, a complete option that accepts incoming drags and retains selection and keyboard behavior. Each row has one drop-target registration: same-list drags belong to sorting, and incoming drags use the explicit target.accept,canDrop,dropDisabled,getDropPosition, andonDraggableDropcontrol acceptance and insertion. NativeonDropremains available for HTML drag-and-drop events. Disabled sorting targets reject ancestor fallback through the common sorting adapter.kind. Payloads contain picked-up item values, item IDs, collection identity, and application data fromgetDragPayload. Sorting and external-drop callbacks both expose aDragSourcethroughsource, with application payloads undersource.payload. Transfers remain application-owned.ItemDragHandlewithSortHandle, addSortPreview, and exposeItem.draggablePropsfor activation, modifiers, and drag callbacks. Custom placement uses normalized row coordinates and supports horizontal layouts and RTL.onDropPositionChangeexposes placement updates;onSortEndreports the final pointer outcome.data-moving) from the physically picked-up item (data-dragging). Replacedata-drop-targetanddata-drop-target-edgewithdata-drag-overand logicaldata-drop-position="before" | "after"states, shared by sorting and external drops.getAnnouncement. Preserve nested controls' keyboard behavior and let handled sorting shortcuts bubble with their default prevented. Keep nested Listbox sorting contexts isolated and preserve selection and focus through reorders.Validation: focused Listbox/shared-target/demo Chromium tests pass, along with the corresponding jsdom checks, TypeScript, formatting, stylelint, and generated API documentation. ESLint passes with the pre-existing local
docs/CLAUDE.mdissue excluded.