ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Refactor removed ability to handle Enter & arrow keys on grid

Open ghost opened this issue 11 years ago • 3 comments

Refactor: https://github.com/angular-ui/ng-grid/pull/3120 says this:

If you have a custom editor, you will no longer receive keyDown/Up events from the readonly cell. Use the cellNav api viewPortKeyDown to capture any needed keydown events.

The problem is that viewPortKeyDown does not get called for navigation keystrokes (specifically Enter and Left/Right Arrow). Previous to this refactor, we could attach an ng-keydown in a cell template to handle these keys.

We desperately need this, as the Enter key lets us submit the form the user is on and the left/right arrow keys let us scroll the grid immediately, irrespective of which column has focus.

I can try to submit a bug fix if that's preferred, though I might not implement it properly...

ghost avatar Jun 18 '15 14:06 ghost

Where the navigation keys get eaten is here:

              // Bind to keydown events in the render container
              focuser.on('keydown', function (evt) {
                evt.uiGridTargetRenderContainerId = containerId;
                var rowCol = uiGridCtrl.grid.api.cellNav.getFocusedCell();
                var result = uiGridCtrl.cellNav.handleKeyDown(evt);
                if (result === null) {
                  uiGridCtrl.grid.api.cellNav.raise.viewPortKeyDown(evt, rowCol);
                }
              });

The result is not null if you use navigation keys, so they're never sent to viewPortKeyDown

ghost avatar Jun 18 '15 14:06 ghost

We also have to react on the Navigation/enter keys in code. Would be nice if those key are available in the viewPortKeyDown Event.

JZehet avatar Jan 11 '16 15:01 JZehet

+1

ghost avatar Jan 19 '17 16:01 ghost