Skip to content

Commit

Permalink
fix: Move past non focusable cell while navigating
Browse files Browse the repository at this point in the history
  • Loading branch information
netchampfaris committed Aug 11, 2019
1 parent 8b9cd64 commit a47e1f0
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/cellmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export default class CellManager {

// reset header background
if (this.lastHeaders) {
this.lastHeaders.forEach(header => header.classList.remove('dt-cell--highlight'));
this.lastHeaders.forEach(header => header && header.classList.remove('dt-cell--highlight'));
}
}

Expand All @@ -260,14 +260,14 @@ export default class CellManager {
const rowHeaderSelector = `.dt-cell--${srNoColIndex}-${rowIndex}`;

if (this.lastHeaders) {
this.lastHeaders.forEach(header => header.classList.remove('dt-cell--highlight'));
this.lastHeaders.forEach(header => header && header.classList.remove('dt-cell--highlight'));
}

const colHeader = $(colHeaderSelector, this.wrapper);
const rowHeader = $(rowHeaderSelector, this.wrapper);

this.lastHeaders = [colHeader, rowHeader];
this.lastHeaders.forEach(header => header.classList.add('dt-cell--highlight'));
this.lastHeaders.forEach(header => header && header.classList.add('dt-cell--highlight'));
}

selectAreaOnClusterChanged() {
Expand Down Expand Up @@ -658,6 +658,26 @@ export default class CellManager {
$cell = this.getBelowCell$($cell);
}

if (!$cell) {
return false;
}

const {
colIndex
} = $.data($cell);
const column = this.columnmanager.getColumn(colIndex);

if (!column.focusable) {
let $prevFocusedCell = this.$focusedCell;
this.unfocusCell($prevFocusedCell);
this.$focusedCell = $cell;
let ret = this.focusCellInDirection(direction);
if (!ret) {
this.focusCell($prevFocusedCell);
}
return ret;
}

this.focusCell($cell);
return true;
}
Expand Down

0 comments on commit a47e1f0

Please sign in to comment.