I have a dgrid like OnDemandGrid.createSubclass([ Keyboard, ColumnResizer ]).createSubclass([ Tree, Editor, DnD ])
With DnD enabled, clicking on a cell doesn't move the "keyboard focus" there. Meaning arrow keys jump back to the previous cell selected using the keyboard or by clicking on a form element.
I tracked the issue to this repo, dnd/Selector.jshere and here.
It seems the mousedown event doesn't reach some relevant handler in dgrid. The stopPropagation in this repo was apparently intended to stop text selection, but dgrid or its mixins already handle that.
I don't know of any nice way to handle this special case with dgrid without possibly breaking something else. I simply used dojo/aspect to redirect the event's stopPropagation and preventDefault methods to blank functions before reaching onMouseDown in Selector.js. That fixes the problem for my case.
For the record, here's the (TypeScript) code for patching the event:
import * as Source from 'dojo/dnd/Source';
function nop() {}
aspect.before((Source as any).superclass, 'onMouseDown', (e: MouseEvent) => {
e.stopPropagation = nop;
e.preventDefault = nop;
return([ e ]);
});
As reported by @jjrv in https://github.com/dojo/dojo/issues/278:
I have a dgrid like
OnDemandGrid.createSubclass([ Keyboard, ColumnResizer ]).createSubclass([ Tree, Editor, DnD ])
With
DnD
enabled, clicking on a cell doesn't move the "keyboard focus" there. Meaning arrow keys jump back to the previous cell selected using the keyboard or by clicking on a form element.I tracked the issue to this repo,
dnd/Selector.js
here and here.It seems the mousedown event doesn't reach some relevant handler in dgrid. The
stopPropagation
in this repo was apparently intended to stop text selection, but dgrid or its mixins already handle that.I don't know of any nice way to handle this special case with dgrid without possibly breaking something else. I simply used
dojo/aspect
to redirect the event'sstopPropagation
andpreventDefault
methods to blank functions before reachingonMouseDown
inSelector.js
. That fixes the problem for my case.For the record, here's the (TypeScript) code for patching the event: