Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/cellmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class CellManager {
this.bindKeyboardSelection();
this.bindCopyCellContents();
this.bindMouseEvents();
this.bindWheelEvents();
this.bindTreeEvents();
}

Expand Down Expand Up @@ -81,6 +82,7 @@ export default class CellManager {
}

this.focusCell($cell);
sessionStorage.setItem('dt-last-nav-method', 'key');
return true;
};

Expand Down Expand Up @@ -189,6 +191,12 @@ export default class CellManager {
$.on(this.bodyScrollable, 'mousemove', '.dt-cell', throttle(selectArea, 50));
}

bindWheelEvents() {
$.on(this.bodyScrollable, 'wheel', (e) => {
sessionStorage.setItem('dt-last-nav-method', 'scroll');
});
}

bindTreeEvents() {
$.on(this.bodyScrollable, 'click', '.dt-tree-node__toggle', (e, $toggle) => {
const $cell = $.closest('.dt-cell', $toggle);
Expand Down Expand Up @@ -313,11 +321,13 @@ export default class CellManager {
// this function is called after hyperlist renders the rows after scroll,
// focusCell calls clearSelection which resets the area selection
// so a flag to skip it
// we also skip DOM focus and scroll to cell
// because it fights with the user scroll
// we skip scroll to cell
// and also skip DOM focus (if user is scrolling) because it fights with the user scroll
const skipDOMFocus = sessionStorage.getItem('dt-last-nav-method') !== 'key';

this.focusCell($cell, {
skipDOMFocus,
skipClearSelection: 1,
skipDOMFocus: 1,
skipScrollToCell: 1
});
}
Expand Down Expand Up @@ -714,6 +724,7 @@ export default class CellManager {
}

this.focusCell($cell);
sessionStorage.setItem('dt-last-nav-method', 'key');
return true;
}

Expand Down
Loading