Skip to content

Commit

Permalink
Bugfix: Handle tab event manually for visually smooth transition
Browse files Browse the repository at this point in the history
  • Loading branch information
csengor committed Jun 7, 2021
1 parent bfd9214 commit 7355217
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,15 @@ function targetKeydownHandler(e, target_cell) {
target_cell.innerHTML = target_cell.parentNode.getElementsByClassName("source")[0].innerHTML;
}
}
else if ( e.shiftKey || e.key == "Tab") {}
else if (e.key == "Tab") {
e.preventDefault();
targetList = [...document.getElementsByClassName("target")].slice(1);
currentId = targetList.findIndex(function(element){return element==target_cell})
if (currentId < targetList.length) {
targetList[currentId+1].focus();
}
}
else if ( e.shiftKey) {}
else {
target_cell.parentNode.classList.remove("translated");
target_cell.parentNode.classList.add("draft");
Expand Down

0 comments on commit 7355217

Please sign in to comment.