telerik / kendo-angular

Issue tracker - Kendo UI for Angular
http://www.telerik.com/kendo-angular-ui/
Other
469 stars 218 forks source link

[Grid] New row's editable input does not get focused if its column has been focused #3659

Open ipeshev opened 2 years ago

ipeshev commented 2 years ago

Describe the bug New row's editable input does not get focused if its column has been already focused, it does get correctly focused when "Add new" is directly clicked (without entering editable cell first).

To Reproduce Built-In Directives - Grid - Kendo UI for Angular (telerik.com)

  1. Open the demo -Built-In Directives - Grid - Kendo UI for Angular
  2. Click on the first cell of the first row
  3. Press Esc to exit the edit mode (this will close the editor and leave focus at the cell)
  4. Press Add new button to insert new row
  5. Look at the input — it does not have focused state indication

Expected behavior It should focus cell's input in, when "Add new" is invoked.

tsvetomir commented 2 years ago

Seems like the focus is not correctly updated as the cell element is reused, and thus already focused. A possible workaround until this is fixed is to reset the focus when clicking the Add button, see demo:

<ng-template kendoGridToolbarTemplate>
    <button kendoGridAddCommand (click)="resetFocus(grid)">Add new</button>
</ng-template>
...
public resetFocus(grid: GridComponent) {
    grid.focusCell(0, 0);
}