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

Method cancelEvent

packages/react-aria/src/dnd/DragManager.ts:373–390  ·  view source on GitHub ↗
(e: Event)

Source from the content-addressed store, hash-verified

371 }
372
373 cancelEvent(e: Event): void {
374 // Allow focusin and focusout on the drag target so focus ring works properly.
375 let eventTarget = getEventTarget(e);
376 if (
377 (e.type === 'focusin' || e.type === 'focusout') &&
378 (eventTarget === this.dragTarget?.element || eventTarget === this.getCurrentActivateButton())
379 ) {
380 return;
381 }
382
383 // Allow default for events that might cancel a click event
384 if (!CLICK_EVENTS.includes(e.type)) {
385 e.preventDefault();
386 }
387
388 e.stopPropagation();
389 e.stopImmediatePropagation();
390 }
391
392 updateValidDropTargets(): void {
393 if (!this.mutationObserver) {

Callers 6

onKeyDownMethod · 0.95
onKeyUpMethod · 0.95
onFocusMethod · 0.95
onBlurMethod · 0.95
onClickMethod · 0.95
onPointerDownMethod · 0.95

Calls 2

getEventTargetFunction · 0.90

Tested by

no test coverage detected