avallete / ag-grid-autocomplete-editor

Quick implementation of autocompletion into ag-Grid cell using autocompleter package.
MIT License
49 stars 25 forks source link

Cells not in focus after selection on autocomplete cells #81

Closed Unidraga closed 3 years ago

Unidraga commented 4 years ago

Using the demo given, under the "Ajax country request" column.

When you type 'cana' and hit Tab key, it'll select 'Canada' and move over the right, which is the 'Capital slow request with spinner' column.

However, it is not in focus anymore and it doesn't take any input from the keyboard until you give it a mouse click.

The default behavior is that it should be editable.

Take 'Price' column for example, after you enter a value and hit Tab key, you will be able to enter 'cana'

avallete commented 4 years ago

Bug confirmed, nice spot.

Whenever we navigate using tab from the AutocompleteCellEditor, seem that something has changed with latest ag-grid update.

Was one of the only behaviour I cannot test with Cypress (see here). I will check that whenever I have some time.

rrajewski commented 4 years ago

Not the best way to handle this, but this is the current workaround I am using.

    // hack to restore focus to ag-grid when tab-ing out of cell
    onCellValueChanged: (params: CellValueChangedEvent) => {
      const focusedCell = params?.api?.getFocusedCell();
      const focusedColID = focusedCell?.column?.getColId();

      if (focusedCell && focusedColID !== params.column?.getColId()) {
        params.api.startEditingCell({
          colKey: focusedCell.column.getColId(),
          rowIndex: focusedCell.rowIndex,
        });
      }
    },
avallete commented 3 years ago

This behavior could now be tested with cypress-real-event (related to) #93

avallete commented 3 years ago

fixed and now tested here: https://github.com/avallete/ag-grid-autocomplete-editor/blob/14a7ff5ddbfa4a11cf3cee69d4e10a16b980c731/cypress/integration/end-to-end/ag-grid-autocomplete-editor/basic.test.ts#L580