File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,11 @@ export function useRovingCellRef(isSelected: boolean) {
9
9
setIsChildFocused ( false ) ;
10
10
}
11
11
12
- const ref = useCallback (
13
- ( cell : HTMLDivElement | null ) => {
14
- if ( cell === null || ! isSelected || cell . contains ( document . activeElement ) ) return ;
12
+ const ref = useCallback ( ( cell : HTMLDivElement | null ) => {
13
+ if ( cell === null || cell . contains ( document . activeElement ) ) return ;
15
14
16
- cell . focus ( { preventScroll : true } ) ;
17
- } ,
18
- [ isSelected ]
19
- ) ;
15
+ cell . focus ( { preventScroll : true } ) ;
16
+ } , [ ] ) ;
20
17
21
18
function onFocus ( event : React . FocusEvent < HTMLDivElement > ) {
22
19
if ( event . target !== event . currentTarget ) {
@@ -27,7 +24,7 @@ export function useRovingCellRef(isSelected: boolean) {
27
24
const isFocused = isSelected && ! isChildFocused ;
28
25
29
26
return {
30
- ref,
27
+ ref : isSelected ? ref : undefined ,
31
28
tabIndex : isFocused ? 0 : - 1 ,
32
29
onFocus
33
30
} ;
You can’t perform that action at this time.
0 commit comments