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

Method cancel

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

Source from the content-addressed store, hash-verified

632 }
633
634 cancel(): void {
635 this.setCurrentDropTarget(null);
636 this.end();
637 if (!this.dragTarget.element.closest('[aria-hidden="true"], [inert]')) {
638 this.dragTarget.element.focus();
639 }
640
641 // Re-trigger focus event on active element, since it will not have received it during dragging (see cancelEvent).
642 getActiveElement()?.dispatchEvent(new FocusEvent('focusin', {bubbles: true}));
643
644 announce(this.stringFormatter.format('dropCanceled'));
645 }
646
647 drop(item?: DroppableItem): void {
648 if (!this.currentDropTarget) {

Callers 12

onKeyDownMethod · 0.95
onClickMethod · 0.95
dropMethod · 0.95
useEnterAnimationFunction · 0.80
startAnimationFunction · 0.80
MouseAnimationFunction · 0.80
ListBoxExampleFunction · 0.80
MobileFunction · 0.80
startAnimationFunction · 0.80
PressAnimationFunction · 0.80
useLoadingAnimationFunction · 0.80

Calls 6

setCurrentDropTargetMethod · 0.95
endMethod · 0.95
getActiveElementFunction · 0.90
announceFunction · 0.90
focusMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected