Skip to content

Commit

Permalink
Add Keyboard Navigation to Tour Window (#3493)
Browse files Browse the repository at this point in the history
* key listeners added to right and left key

* space removed
  • Loading branch information
sujithyadav998 authored Dec 30, 2023
1 parent d2a79ca commit edc86c4
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions js/widgets/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ class HelpWidget {
this.widgetWindow = widgetWindow;
widgetWindow.clear();
widgetWindow.show();
widgetWindow.onClose = () => {
widgetWindow.onclose = () => {
this.isOpen = false;
this.destroy();
document.onkeydown = activity.__keyPressed ;
widgetWindow.destroy();
};
// Position the widget and make it visible.
this._helpDiv = document.createElement("div");
Expand Down Expand Up @@ -99,6 +100,14 @@ class HelpWidget {
leftArrow = document.getElementById("left-arrow");
leftArrow.style.display = "block";
leftArrow.classList.add("hover");

document.onkeydown = function handleArrowKeys(event) {
if (event.key === 'ArrowLeft') {
leftArrow.click();
} else if (event.key === 'ArrowRight') {
rightArrow.click();
}
} ;

let cell = docById("left-arrow");
if (page === 0){
Expand Down Expand Up @@ -401,6 +410,16 @@ class HelpWidget {
this.widgetWindow.sendToCenter();
let cell = docById("right-arrow");
let rightArrow = docById("right-arrow");
let leftArrow = docById("left-arrow");

document.onkeydown = function handleArrowKeys(event) {
if (event.key === 'ArrowLeft') {
leftArrow.click();
} else if (event.key === 'ArrowRight') {
rightArrow.click();
}
} ;

if(this.index == this.appendedBlockList.length - 1)
{
rightArrow.classList.add("disabled") ;       
Expand Down

0 comments on commit edc86c4

Please sign in to comment.