fix: Move past non focusable cell while navigating

This commit is contained in:
Faris Ansari 2019-08-11 18:00:39 +05:30
parent 8b9cd641b1
commit a47e1f07eb

View File

@ -245,7 +245,7 @@ export default class CellManager {
// reset header background // reset header background
if (this.lastHeaders) { if (this.lastHeaders) {
this.lastHeaders.forEach(header => header.classList.remove('dt-cell--highlight')); this.lastHeaders.forEach(header => header && header.classList.remove('dt-cell--highlight'));
} }
} }
@ -260,14 +260,14 @@ export default class CellManager {
const rowHeaderSelector = `.dt-cell--${srNoColIndex}-${rowIndex}`; const rowHeaderSelector = `.dt-cell--${srNoColIndex}-${rowIndex}`;
if (this.lastHeaders) { 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 colHeader = $(colHeaderSelector, this.wrapper);
const rowHeader = $(rowHeaderSelector, this.wrapper); const rowHeader = $(rowHeaderSelector, this.wrapper);
this.lastHeaders = [colHeader, rowHeader]; 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() { selectAreaOnClusterChanged() {
@ -658,6 +658,26 @@ export default class CellManager {
$cell = this.getBelowCell$($cell); $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); this.focusCell($cell);
return true; return true;
} }