Skip to content

Commit

Permalink
fix navigation with rowheader
Browse files Browse the repository at this point in the history
Navigating to left with keyboard can make it select the rowHeader. To
fix this, we check if rowHeader exists from SelectRange. Range is not
responsible for checking rowHeader for the most part anymore.
  • Loading branch information
azmy60 committed Apr 4, 2024
1 parent 5d16d4e commit 209342d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
18 changes: 1 addition & 17 deletions src/js/modules/SelectRange/Range.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ export default class Range extends CoreFeature{
this.start = {row:0, col:0};
this.end = {row:0, col:0};

if(this.rangeManager.rowHeader){
this.left = 1;
this.right = 1;
this.start.col = 1;
this.end.col = 1;
}

this.initElement();

setTimeout(() => {
Expand Down Expand Up @@ -84,21 +77,12 @@ export default class Range extends CoreFeature{
}

setStartBound(element){
var row, col;

if (element.type === "column") {
if(this.rangeManager.columnSelection){
this.setStart(0, element.getPosition() - 1);
}
}else{
row = element.row.position - 1;
col = element.column.getPosition() - 1;

if (element.column === this.rangeManager.rowHeader) {
this.setStart(row, 1);
} else {
this.setStart(row, col);
}
this.setStart(element.row.position - 1, element.column.getPosition() - 1);
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/js/modules/SelectRange/SelectRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ export default class SelectRange extends Module {
break;
}
}

if(this.rowHeader && nextCol === 0) {
nextCol = 1;
}

moved = nextCol !== rangeEdge.col || nextRow !== rangeEdge.row;

Expand Down

0 comments on commit 209342d

Please sign in to comment.