define(["dojo/_base/declare", "dojo/on", "dojo/query"], function(declare, listen, query){
return declare([], {
	// summary:
	// 		Add keyboard navigation capability to a grid
	postCreate: function(){
		this.inherited(arguments);
		this.on(".d-list-row:keydown", function(event){
			if(event.target.tagName.toLowerCase() == "input"){
				return;
			}
			var nextFocus, lastFocus = event.target;
			var columnId = lastFocus.getAttribute("colid");
			switch(event.keyCode){
				case 37: // left arrow
					var previous = true;
				case 39:// right arrow
					nextFocus = lastFocus;
					columnId = null;
					break;
				case 38: // up arrow
					var previous = true;
					// fall through 
				case 40: // down arrow
					nextFocus = this;
					break;
				default: // not an arrow key, just go to default
					return;
			}
			do{
				nextFocus = nextFocus[previous ? 'previousSibling' : 'nextSibling'];
			}while(nextFocus && nextFocus.nodeType != 1);
			if(nextFocus){
				if(columnId){
					nextFocus = query('[colid="' + columnId +'"]', nextFocus)[0];
				}
				nextFocus.focus();
			}
			event.preventDefault();
			
		});
	}
});
});
@@ -36,22 +36,8 @@
 /on%22
-, %22dojo/query%22
 %5D, f
@@ -69,16 +69,16 @@
 query)%7B%0A
+
 return d
@@ -214,29 +214,36 @@
 ;%0A%09%09
-this.on(%22.d-list-row:
+var grid = this;%0A%09%09this.on(%22
 keyd
@@ -412,29 +412,16 @@
 cus.
-getAttribute(%22colid%22)
+columnId
 ;%0A%09%09
@@ -703,20 +703,43 @@
 Focus = 
-this
+grid.row(lastFocus).element
 ;%0A%09%09%09%09%09b
@@ -1001,56 +1001,46 @@
 s = 
-query('%5Bcolid=%22' + columnId +'%22%5D', nextFocus)%5B0%5D
+grid.cell(nextFocus, columnId).element
 ;%0A%09%09

Fix focus handling