Skip to main content

Reorder Handle

The ReorderHandle is an element that adds drag-and-drop functionality to other elements, and serves as a handle for moving items in a group of elements.

Basic use

Locking handle

By adding the lock attribute to the ReorderHandle element, you can block the ability to drag and drop items, preventing users from reordering items.

Without dropzone (For use in menus)

Elements can be moved within their parent container without the need to explicitly define a dropzone attribute, simplifying the implementation of drag-and-drop functionality.

When to use

Use wje-reorder-handle when you need a consistent WebJET-based implementation for this UI concern.

When not to use

Do not stretch the component beyond its responsibility; compose smaller primitives for edge cases.

Accessibility

Validate keyboard behavior, focus states, contrast, and meaningful labels for interactive elements.

Best Practices

  • Prefer component APIs over direct DOM manipulation.
  • Stick to design tokens and naming conventions.
  • Test components with realistic data before production rollout.

Attributes and Properties

dropzone

DescriptionControls how dropzone behaves in the component.
Attributedropzone
Typeany
Default-

parent

DescriptionControls how parent behaves in the component.
Attributeparent
Typeany
Default-

Events

NameDescription
wje-reorder-handle:startEmitted when the wje-reorder-handle:start event is dispatched.
wje-reorder-handle:changeEmitted when the component value changes.

Methods

startDrag

DescriptionHandles the attribute changes.
Signature(e: DragEvent) => void

startTouchDrag

DescriptionHandles the touch start event.
Signature(e: TouchEvent) => void

startDragAction

DescriptionInitiates the drag-and-drop action for a sortable element.
Signature(clientX: number, clientY: number) => void

getDraggable

DescriptionRetrieves the closest draggable element based on attribute conditions. If the element has a "parent" attribute, the method attempts to find the closest ancestor matching the CSS selector specified in the attribute. If no such ancestor exists, the method defaults to returning the immediate parent element.
Signature() => Element|null

getDropzone

DescriptionRetrieves the nearest dropzone element based on the element's attributes or its parent element.
Signature(element: HTMLElement) => HTMLElement|null

getClosestDropzone

DescriptionRetrieves the closest dropzone element at the specified coordinates.
Signature(clientX: number, clientY: number) => HTMLElement|null

getElementsFromPointAll

DescriptionRetrieves all elements at the specified coordinates, including those within shadow DOMs.
Signature(x: number, y: number, root?: Document|ShadowRoot, visited?: Set<Node>) => HTMLElement[]

reIndexItems

DescriptionRe-indexes child elements of the given container by setting their dataset index.
Signature(container: HTMLElement) => void

CSS Shadow Parts

NameDescription
nativeThe native part of the reorder handle.

CSS Custom Properties

No CSS custom properties available for this component.

Slots

NameDescription
defaultThe default slot for the reorder handle.