@@ -23,7 +23,7 @@ import {
23
23
useUnwrapDOMRef
24
24
} from '@react-spectrum/utils' ;
25
25
import { ColumnSize , SpectrumColumnProps , SpectrumTableProps } from '@react-types/table' ;
26
- import { DOMRef , FocusableRef , MoveMoveEvent } from '@react-types/shared' ;
26
+ import { DOMRef , FocusableRef } from '@react-types/shared' ;
27
27
import { FocusRing , FocusScope , useFocusRing } from '@react-aria/focus' ;
28
28
import { getInteractionModality , useHover , usePress } from '@react-aria/interactions' ;
29
29
import { GridNode } from '@react-types/grid' ;
@@ -97,7 +97,6 @@ interface TableContextValue<T> {
97
97
onResizeStart : ( widths : Map < Key , ColumnSize > ) => void ,
98
98
onResize : ( widths : Map < Key , ColumnSize > ) => void ,
99
99
onResizeEnd : ( widths : Map < Key , ColumnSize > ) => void ,
100
- onMoveResizer : ( e : MoveMoveEvent ) => void ,
101
100
headerMenuOpen : boolean ,
102
101
setHeaderMenuOpen : ( val : boolean ) => void
103
102
}
@@ -361,14 +360,6 @@ function TableView<T extends object>(props: SpectrumTableProps<T>, ref: DOMRef<H
361
360
bodyRef . current . scrollLeft = headerRef . current . scrollLeft ;
362
361
} ;
363
362
364
- let lastResizeInteractionModality = useRef ( undefined ) ;
365
- let onMoveResizer = ( e ) => {
366
- if ( e . pointerType === 'keyboard' ) {
367
- lastResizeInteractionModality . current = e . pointerType ;
368
- } else {
369
- lastResizeInteractionModality . current = undefined ;
370
- }
371
- } ;
372
363
let onResizeStart = useCallback ( ( widths ) => {
373
364
setIsResizing ( true ) ;
374
365
propsOnResizeStart ?.( widths ) ;
@@ -380,7 +371,7 @@ function TableView<T extends object>(props: SpectrumTableProps<T>, ref: DOMRef<H
380
371
} , [ propsOnResizeEnd , setIsInResizeMode , setIsResizing ] ) ;
381
372
382
373
return (
383
- < TableContext . Provider value = { { state, layout, onResizeStart, onResize : props . onResize , onResizeEnd, headerRowHovered, isInResizeMode, setIsInResizeMode, isEmpty, onFocusedResizer, onMoveResizer , headerMenuOpen, setHeaderMenuOpen} } >
374
+ < TableContext . Provider value = { { state, layout, onResizeStart, onResize : props . onResize , onResizeEnd, headerRowHovered, isInResizeMode, setIsInResizeMode, isEmpty, onFocusedResizer, headerMenuOpen, setHeaderMenuOpen} } >
384
375
< TableVirtualizer
385
376
{ ...mergeProps ( gridProps , focusProps ) }
386
377
{ ...styleProps }
@@ -411,15 +402,14 @@ function TableView<T extends object>(props: SpectrumTableProps<T>, ref: DOMRef<H
411
402
onVisibleRectChange = { onVisibleRectChange }
412
403
domRef = { domRef }
413
404
headerRef = { headerRef }
414
- lastResizeInteractionModality = { lastResizeInteractionModality }
415
405
bodyRef = { bodyRef }
416
406
isFocusVisible = { isFocusVisible } />
417
407
</ TableContext . Provider >
418
408
) ;
419
409
}
420
410
421
411
// This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
422
- function TableVirtualizer ( { layout, collection, lastResizeInteractionModality , focusedKey, renderView, renderWrapper, domRef, bodyRef, headerRef, onVisibleRectChange : onVisibleRectChangeProp , isFocusVisible, ...otherProps } ) {
412
+ function TableVirtualizer ( { layout, collection, focusedKey, renderView, renderWrapper, domRef, bodyRef, headerRef, onVisibleRectChange : onVisibleRectChangeProp , isFocusVisible, ...otherProps } ) {
423
413
let { direction} = useLocale ( ) ;
424
414
let loadingState = collection . body . props . loadingState ;
425
415
let isLoading = loadingState === 'loading' || loadingState === 'loadingMore' ;
@@ -466,11 +456,11 @@ function TableVirtualizer({layout, collection, lastResizeInteractionModality, fo
466
456
// only that it changes in a resize, and when that happens, we want to sync the body to the
467
457
// header scroll position
468
458
useEffect ( ( ) => {
469
- if ( lastResizeInteractionModality . current === 'keyboard' && headerRef . current . contains ( document . activeElement ) ) {
459
+ if ( getInteractionModality ( ) === 'keyboard' && headerRef . current . contains ( document . activeElement ) ) {
470
460
document . activeElement ?. scrollIntoView ?.( { block : 'nearest' , inline : 'nearest' } ) ;
471
461
bodyRef . current . scrollLeft = headerRef . current . scrollLeft ;
472
462
}
473
- } , [ state . contentSize , headerRef , bodyRef , lastResizeInteractionModality ] ) ;
463
+ } , [ state . contentSize , headerRef , bodyRef ] ) ;
474
464
475
465
let headerHeight = layout . getLayoutInfo ( 'header' ) ?. rect . height || 0 ;
476
466
let visibleRect = state . virtualizer . visibleRect ;
@@ -662,7 +652,6 @@ function ResizableTableColumnHeader(props) {
662
652
setIsInResizeMode,
663
653
isEmpty,
664
654
onFocusedResizer,
665
- onMoveResizer,
666
655
isInResizeMode,
667
656
headerMenuOpen,
668
657
setHeaderMenuOpen
@@ -807,8 +796,7 @@ function ResizableTableColumnHeader(props) {
807
796
onResizeStart = { onResizeStart }
808
797
onResize = { onResize }
809
798
onResizeEnd = { onResizeEnd }
810
- triggerRef = { useUnwrapDOMRef ( triggerRef ) }
811
- onMoveResizer = { onMoveResizer } />
799
+ triggerRef = { useUnwrapDOMRef ( triggerRef ) } />
812
800
< div
813
801
aria-hidden
814
802
className = { classNames (
0 commit comments