@@ -33,6 +33,7 @@ export default class CellManager {
3333 this . bindKeyboardSelection ( ) ;
3434 this . bindCopyCellContents ( ) ;
3535 this . bindMouseEvents ( ) ;
36+ this . bindWheelEvents ( ) ;
3637 this . bindTreeEvents ( ) ;
3738 }
3839
@@ -81,6 +82,7 @@ export default class CellManager {
8182 }
8283
8384 this . focusCell ( $cell ) ;
85+ sessionStorage . setItem ( 'dt-last-nav-method' , 'key' ) ;
8486 return true ;
8587 } ;
8688
@@ -189,6 +191,12 @@ export default class CellManager {
189191 $ . on ( this . bodyScrollable , 'mousemove' , '.dt-cell' , throttle ( selectArea , 50 ) ) ;
190192 }
191193
194+ bindWheelEvents ( ) {
195+ $ . on ( this . bodyScrollable , 'wheel' , ( e ) => {
196+ sessionStorage . setItem ( 'dt-last-nav-method' , 'scroll' ) ;
197+ } ) ;
198+ }
199+
192200 bindTreeEvents ( ) {
193201 $ . on ( this . bodyScrollable , 'click' , '.dt-tree-node__toggle' , ( e , $toggle ) => {
194202 const $cell = $ . closest ( '.dt-cell' , $toggle ) ;
@@ -313,11 +321,13 @@ export default class CellManager {
313321 // this function is called after hyperlist renders the rows after scroll,
314322 // focusCell calls clearSelection which resets the area selection
315323 // so a flag to skip it
316- // we also skip DOM focus and scroll to cell
317- // because it fights with the user scroll
324+ // we skip scroll to cell
325+ // and also skip DOM focus (if user is scrolling) because it fights with the user scroll
326+ const skipDOMFocus = sessionStorage . getItem ( 'dt-last-nav-method' ) !== 'key' ;
327+
318328 this . focusCell ( $cell , {
329+ skipDOMFocus,
319330 skipClearSelection : 1 ,
320- skipDOMFocus : 1 ,
321331 skipScrollToCell : 1
322332 } ) ;
323333 }
@@ -714,6 +724,7 @@ export default class CellManager {
714724 }
715725
716726 this . focusCell ( $cell ) ;
727+ sessionStorage . setItem ( 'dt-last-nav-method' , 'key' ) ;
717728 return true ;
718729 }
719730
0 commit comments