13
13
import { ActionButtonGroupContext } from './ActionButtonGroup' ;
14
14
import { ActionMenuContext } from './ActionMenu' ;
15
15
import {
16
+ Button ,
16
17
ButtonContext ,
17
18
Collection ,
18
19
Provider ,
@@ -36,9 +37,8 @@ import {isAndroid} from '@react-aria/utils';
36
37
import { raw } from '../style/style-macro' with { type : 'macro' } ;
37
38
import React , { createContext , forwardRef , isValidElement , JSXElementConstructor , ReactElement , useContext , useMemo , useRef } from 'react' ;
38
39
import { Text , TextContext } from './Content' ;
39
- import { useButton } from '@ react-aria/button ' ;
40
+ import { useLocale } from 'react-aria' ;
40
41
import { useDOMRef } from '@react-spectrum/utils' ;
41
- import { useLocale } from '@react-aria/i18n' ;
42
42
43
43
interface S2TreeProps {
44
44
// Only detatched is supported right now with the current styles from Spectrum
@@ -109,7 +109,7 @@ function TreeView(props: TreeViewProps, ref: DOMRef<HTMLDivElement>) {
109
109
110
110
let layout = useMemo ( ( ) => {
111
111
return new UNSTABLE_ListLayout ( {
112
- rowHeight : isDetached ? 44 : 40
112
+ rowHeight : isDetached ? 42 : 40
113
113
} ) ;
114
114
} , [ isDetached ] ) ;
115
115
@@ -257,7 +257,10 @@ const treeCellGrid = style({
257
257
} ,
258
258
borderTopWidth : {
259
259
default : 0 ,
260
- isFirst : 1 ,
260
+ isFirst : {
261
+ default : 1 ,
262
+ forcedColors : 0
263
+ } ,
261
264
isDetached : 1
262
265
} ,
263
266
borderBottomWidth : {
@@ -414,7 +417,7 @@ export const TreeViewItem = <T extends object>(props: TreeViewItemProps<T>) => {
414
417
styles : style ( { size : fontRelative ( 20 ) , flexShrink : 0 } )
415
418
} ] ,
416
419
[ ActionButtonGroupContext , { styles : treeActions } ] ,
417
- [ ActionMenuContext , { styles : treeActionMenu , isQuiet : true , 'aria-label' : 'Actions' } ]
420
+ [ ActionMenuContext , { styles : treeActionMenu , isQuiet : true } ]
418
421
] } >
419
422
{ content }
420
423
</ Provider >
@@ -450,29 +453,26 @@ const expandButton = style<ExpandableRowChevronProps>({
450
453
isRTL : 'rotate(-90deg)'
451
454
}
452
455
} ,
453
- transition : 'default'
456
+ transition : 'default' ,
457
+ backgroundColor : 'transparent' ,
458
+ borderStyle : 'none'
454
459
} ) ;
455
460
456
461
function ExpandableRowChevron ( props : ExpandableRowChevronProps ) {
457
- let expandButtonRef = useRef < HTMLSpanElement > ( null ) ;
458
- // @ts -ignore - check back on this
462
+ let expandButtonRef = useRef < HTMLButtonElement > ( null ) ;
459
463
let [ fullProps , ref ] = useContextProps ( { ...props , slot : 'chevron' } , expandButtonRef , ButtonContext ) ;
460
464
let { isExpanded, isDisabled} = fullProps ;
461
465
let { direction} = useLocale ( ) ;
462
466
463
- // Will need to keep the chevron as a button for iOS VO at all times since VO doesn't focus the cell. Also keep as button if cellAction is defined by the user in the future
464
- let { buttonProps} = useButton ( {
465
- ...fullProps ,
466
- elementType : 'span'
467
- } , ref ) ;
468
-
469
467
return (
470
- < span
471
- { ...buttonProps }
468
+ < Button
469
+ { ...props }
472
470
ref = { ref }
471
+ slot = "chevron"
473
472
// Override tabindex so that grid keyboard nav skips over it. Needs -1 so android talkback can actually "focus" it
474
- tabIndex = { isAndroid ( ) && ! isDisabled ? - 1 : undefined }
475
- className = { expandButton ( { isExpanded, isDisabled, isRTL : direction === 'rtl' } ) } >
473
+ excludeFromTabOrder = { isAndroid ( ) && ! isDisabled }
474
+ preventFocusOnPress
475
+ className = { renderProps => expandButton ( { ...renderProps , isExpanded, isRTL : direction === 'rtl' } ) } >
476
476
< Chevron
477
477
className = { style ( {
478
478
scale : {
@@ -486,7 +486,7 @@ function ExpandableRowChevron(props: ExpandableRowChevronProps) {
486
486
value : 'currentColor'
487
487
}
488
488
} ) ( { direction} ) } />
489
- </ span >
489
+ </ Button >
490
490
) ;
491
491
}
492
492
0 commit comments