Skip to content

Commit

Permalink
fix(Edit): Retain "focus" in endEdit()
Browse files Browse the repository at this point in the history
When hitting the ESC key in a cell while editing it, the cell was losing
focus when it should have been retained. This fix accounts for the changes
to using actual CSS classes instead of relying on :focus.
  • Loading branch information
c0bra committed Nov 13, 2014
1 parent 0e27c18 commit f3a45ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/features/edit/js/gridEdit.js
Expand Up @@ -557,7 +557,7 @@
$elm.append(cellElement);
$compile(cellElement)($scope.$new());
var gridCellContentsEl = angular.element($elm.children()[0]);
isFocusedBeforeEdit = gridCellContentsEl.hasClass(':focus');
isFocusedBeforeEdit = gridCellContentsEl.hasClass('ui-grid-cell-focus');
gridCellContentsEl.addClass('ui-grid-cell-contents-hidden');
});

Expand Down Expand Up @@ -594,7 +594,7 @@
angular.element($elm.children()[1]).remove();
gridCellContentsEl.removeClass('ui-grid-cell-contents-hidden');
if (retainFocus && isFocusedBeforeEdit) {
gridCellContentsEl.focus();
gridCellContentsEl[0].focus();
}
isFocusedBeforeEdit = false;
inEdit = false;
Expand Down

0 comments on commit f3a45ef

Please sign in to comment.