Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/HFP-4085'
Browse files Browse the repository at this point in the history
  • Loading branch information
otacke committed Jul 29, 2024
2 parents 4c6afaa + e3c2a6e commit 4179829
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/scripts/h5p-crossword-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,11 +651,6 @@ export default class CrosswordTable {
* @param {boolean} [keepOrientation] If true, don't toggle orientation on repeated focus.
*/
handleCellClick(position, keepOrientation = false) {
if (this.ignoreNextClick) {
this.ignoreNextClick = false;
return;
}

const cell = this.cells[position.row][position.column];
if (!cell.getSolution()) {
return;
Expand All @@ -674,8 +669,14 @@ export default class CrosswordTable {
}
}

this.currentPosition = position;
if (
this.currentPosition.row === position.row &&
this.currentPosition.column === position.column
) {
return; // No need to set the whole moveTo in motion again
}

this.currentPosition = position;
this.moveTo(position, true);
}

Expand All @@ -698,8 +699,7 @@ export default class CrosswordTable {

// Getting focus from outside the grid by tabbing into it
this.setcurrentOrientation(this.currentOrientation, position);
this.handleCellClick(position, true);
this.ignoreNextClick = (typeof this.ignoreNextClick !== 'boolean') ? true : this.ignoreNextClick; // Can't determine first focus on click
this.handleCellClick(position, true, false);
}

/**
Expand Down

0 comments on commit 4179829

Please sign in to comment.