diff --git a/src/features/edit/js/gridEdit.js b/src/features/edit/js/gridEdit.js index b4f209432d..195bf89ed8 100644 --- a/src/features/edit/js/gridEdit.js +++ b/src/features/edit/js/gridEdit.js @@ -785,14 +785,14 @@ if (!inEdit) { return; } - + //sometimes the events can't keep up with the keyboard and grid focus is lost, so always focus //back to grid here. The focus call needs to be before the $destroy and removal of the control, //otherwise ng-model-options of UpdateOn: 'blur' will not work. if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) { uiGridCtrl.focus(); } - + var gridCellContentsEl = angular.element($elm.children()[0]); //remove edit element editCellScope.$destroy(); @@ -874,7 +874,10 @@ $scope.$on(uiGridEditConstants.events.BEGIN_CELL_EDIT, function (evt,triggerEvent) { $timeout(function () { $elm[0].focus(); - $elm[0].select(); + //only select text if it is not being replaced below in the cellNav viewPortKeyPress + if ($scope.col.colDef.enableCellEditOnFocus || !(uiGridCtrl && uiGridCtrl.grid.api.cellNav)) { + $elm[0].select(); + } }); //set the keystroke that started the edit event