Skip to content

Commit

Permalink
fix(edit): add/remove mousedown events in cellNav on beginEdit/endEdit
Browse files Browse the repository at this point in the history
A recent change by Accessibility disabled mouse events in editors.  this adds it back
  • Loading branch information
swalters committed Jul 31, 2015
1 parent 69f0a80 commit 708231f
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/features/cellnav/js/cellnav.js
Original file line number Diff line number Diff line change
Expand Up @@ -1125,11 +1125,28 @@
* Since the focus event doesn't include key press information we can't use it
* as our primary source of the event.
*/
$elm.on('mousedown', function(evt) {
$elm.on('mousedown', preventMouseDown);

//turn on and off for edit events
if (uiGridCtrl.grid.api.edit) {
uiGridCtrl.grid.api.edit.on.beginCellEdit($scope, function () {
$elm.off('mousedown', preventMouseDown);
});

uiGridCtrl.grid.api.edit.on.afterCellEdit($scope, function () {
$elm.on('mousedown', preventMouseDown);
});

uiGridCtrl.grid.api.edit.on.cancelCellEdit($scope, function () {
$elm.on('mousedown', preventMouseDown);
});
}

function preventMouseDown(evt) {
//Prevents the foucus event from firing if the click event is already going to fire.
//If both events fire it will cause bouncing behavior.
evt.preventDefault();
});
}

//You can only focus on elements with a tabindex value
$elm.on('focus', function (evt) {
Expand Down

0 comments on commit 708231f

Please sign in to comment.