()
| 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(); |
no test coverage detected