Skip to content

Commit

Permalink
add grid tabbing
Browse files Browse the repository at this point in the history
  • Loading branch information
Lily2point0 committed Jun 1, 2017
1 parent 2ea87ed commit 85c1b13
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/js/oCrossword.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ OCrossword.prototype.assemble = function assemble() {

let blockHighlight = false;
let previousClueSelection = null;
let isTab = false;

function constructInputIdentifier(data, direction) {
let identifier;
Expand All @@ -412,16 +413,22 @@ OCrossword.prototype.assemble = function assemble() {
}

if(e.shiftKey && e.keyCode === 9) {
return progress(-1);
isTab = true;
return clueNavigationPrev.click();
}

if (e.keyCode === 13) { //enter
magicInputNextEls = null;
return progress();
}

if (e.keyCode === 9) { //tab
//TODO: get next clue;
isTab = true;
return clueNavigationNext.click();
}

if (
e.keyCode === 9 || //tab
e.keyCode === 40 ||//down
e.keyCode === 39 ||//right
e.keyCode === 32 //space
Expand Down Expand Up @@ -1007,13 +1014,15 @@ OCrossword.prototype.assemble = function assemble() {
currentlySelectedGridItem.answerLength
);

if(!isNavigation) {
if(!isNavigation || isTab) {
takeInput(cell, getGridCellsByNumber(
gridEl,
currentlySelectedGridItem.number,
currentlySelectedGridItem.direction,
currentlySelectedGridItem.answerLength
));

isTab = false;
}
}
}.bind(this);
Expand Down

0 comments on commit 85c1b13

Please sign in to comment.