MCPcopy Index your code
hub / github.com/adobe/react-spectrum / next

Method next

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

Source from the content-addressed store, hash-verified

455 }
456
457 next(): void {
458 // TODO: Allow tabbing to the activate button. Revisit once we fix the focus ring.
459 // For now, the activate button is reachable by screen readers and ArrowLeft/ArrowRight
460 // is usable specifically by Tree. Will need tabbing for other components.
461 // let activateButton = this.getCurrentActivateButton();
462 // if (activateButton && document.activeElement !== activateButton) {
463 // activateButton.focus();
464 // return;
465 // }
466
467 if (!this.currentDropTarget) {
468 this.setCurrentDropTarget(this.validDropTargets[0]);
469 return;
470 }
471
472 let index = this.validDropTargets.indexOf(this.currentDropTarget);
473 if (index < 0) {
474 this.setCurrentDropTarget(this.validDropTargets[0]);
475 return;
476 }
477
478 // If we've reached the end of the valid drop targets, cycle back to the original drag target.
479 // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).
480 if (index === this.validDropTargets.length - 1) {
481 if (!this.dragTarget.element.closest('[aria-hidden="true"], [inert]')) {
482 this.setCurrentDropTarget(null);
483 this.dragTarget.element.focus();
484 } else {
485 this.setCurrentDropTarget(this.validDropTargets[0]);
486 }
487 } else {
488 this.setCurrentDropTarget(this.validDropTargets[index + 1]);
489 }
490 }
491
492 previous(): void {
493 // let activateButton = this.getCurrentActivateButton();

Callers 15

onKeyDownMethod · 0.95
useValueEffectFunction · 0.80
beginDraggingFunction · 0.80
useDroppableCollectionFunction · 0.80
updateMethod · 0.80
useComboBoxStateFunction · 0.80
getFullNodeMethod · 0.80
useSingleSelectListStateFunction · 0.80
useDisclosureGroupStateFunction · 0.80

Calls 2

setCurrentDropTargetMethod · 0.95
focusMethod · 0.80

Tested by

no test coverage detected