Skip to content

Commit 708231f

Browse files
committed
fix(edit): add/remove mousedown events in cellNav on beginEdit/endEdit
A recent change by Accessibility disabled mouse events in editors. this adds it back
1 parent 69f0a80 commit 708231f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/features/cellnav/js/cellnav.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -1125,11 +1125,28 @@
11251125
* Since the focus event doesn't include key press information we can't use it
11261126
* as our primary source of the event.
11271127
*/
1128-
$elm.on('mousedown', function(evt) {
1128+
$elm.on('mousedown', preventMouseDown);
1129+
1130+
//turn on and off for edit events
1131+
if (uiGridCtrl.grid.api.edit) {
1132+
uiGridCtrl.grid.api.edit.on.beginCellEdit($scope, function () {
1133+
$elm.off('mousedown', preventMouseDown);
1134+
});
1135+
1136+
uiGridCtrl.grid.api.edit.on.afterCellEdit($scope, function () {
1137+
$elm.on('mousedown', preventMouseDown);
1138+
});
1139+
1140+
uiGridCtrl.grid.api.edit.on.cancelCellEdit($scope, function () {
1141+
$elm.on('mousedown', preventMouseDown);
1142+
});
1143+
}
1144+
1145+
function preventMouseDown(evt) {
11291146
//Prevents the foucus event from firing if the click event is already going to fire.
11301147
//If both events fire it will cause bouncing behavior.
11311148
evt.preventDefault();
1132-
});
1149+
}
11331150

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

0 commit comments

Comments
 (0)