[Solved] How can I jump to the next row when I navigate with keyCode on the right?

and.neo2020 Asks: How can I jump to the next row when I navigate with keyCode on the right?
I have a table with three columns. In the first column is text and in the second and third are input fields. Within the row I can navigate with keyCode to the right, but when I reach the last column then I can not jump to the next row. What do I have to add to my code to make this possible?

My StackBlitz: Angular Wmfjhh (forked) – StackBlitz


// Snippet from HTML
<tbody formArrayName="rows" *ngIf="rows && rows !== null && !isLoading">
      <tr class="optimize-row" *ngFor="let rowControl of rows.controls; let rowIndex = index">
        <td [formGroupName]="rowIndex" *ngFor="let column of displayedColumns; let columnIndex = index;">
          <div *ngIf="attributesWithFormControls.includes(column.attribute); else otherColumns">
                <input style="background-color: silver" [id]="'row-' + rowIndex + '-col-' + columnIndex" type="text" arrow-div [formControl]="rowControl.get(column.attribute)" (focus)="onFocus($event)">
          <ng-template #otherColumns>
            <div tabindex="0" [id]="'row-' + rowIndex + '-col-' + columnIndex" arrow-div>
              Here is a Number

// TS
   * Use arrowKey
   * @param object any
  move(object) {
    console.log('move', object);

    const id = object.element.nativeElement.id;


    const arr = id.split('-');
    let row: number = Number(arr[1]);
    let col: number = Number(arr[3]);
    switch (object.action) {
      case 'UP':
      case 'DOWN':
      case 'LEFT':
      case 'RIGTH':
    this.setFocus(row, col);

 onFocus(event: FocusEvent): void {
    console.log('onFocus', event.target);

    const target = event.target as HTMLElement;

    if (target.tagName === 'INPUT') {
      this.currentInputInFocus = target;

  private setFocus(row: number, col: number) {
    console.log(`setFocus [row:${row}] [col:${col}]`);
    const newElementToFocusOn = document.getElementById(
    if (newElementToFocusOn) {
      this.currentInputInFocus = newElementToFocusOn;

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.