MCPcopy Create free account
hub / github.com/adobe/react-spectrum / end

Method end

packages/react-aria/src/dnd/DragManager.ts:606–632  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

604 }
605
606 end(): void {
607 this.teardown();
608 endDragging();
609
610 if (typeof this.dragTarget.onDragEnd === 'function') {
611 let target =
612 this.currentDropTarget && this.dropOperation !== 'cancel'
613 ? this.currentDropTarget
614 : this.dragTarget;
615 let rect = target.element.getBoundingClientRect();
616 this.dragTarget.onDragEnd({
617 type: 'dragend',
618 x: rect.x + rect.width / 2,
619 y: rect.y + rect.height / 2,
620 dropOperation: this.dropOperation || 'cancel'
621 });
622 }
623
624 if (this.currentDropTarget && !this.currentDropTarget.preventFocusOnDrop) {
625 // Re-trigger focus event on active element, since it will not have received it during dragging (see cancelEvent).
626 // This corrects state such as whether focus ring should appear.
627 // useDroppableCollection handles this itself, so this is only for standalone drop zones.
628 getActiveElement()?.dispatchEvent(new FocusEvent('focusin', {bubbles: true}));
629 }
630
631 this.setCurrentDropTarget(null);
632 }
633
634 cancel(): void {
635 this.setCurrentDropTarget(null);

Callers 10

cancelMethod · 0.95
dropMethod · 0.95
ssrWorker.jsFile · 0.80
testSSRFunction · 0.80
maybeRespondToPromptFunction · 0.80
runFixtureCLIFunction · 0.80
serveChangedPackagesMethod · 0.80
serveVersionBumpsMethod · 0.80
compareBuildAppSizeFunction · 0.80

Calls 4

teardownMethod · 0.95
setCurrentDropTargetMethod · 0.95
getActiveElementFunction · 0.90
endDraggingFunction · 0.70

Tested by 2

maybeRespondToPromptFunction · 0.64
runFixtureCLIFunction · 0.64