Skip to content

Commit 7806b6e

Browse files
committed
review comments
1 parent e495ef1 commit 7806b6e

File tree

3 files changed

+19
-23
lines changed

3 files changed

+19
-23
lines changed

packages/@react-spectrum/s2/package.json

-2
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@
129129
"jest": "^29.5.0"
130130
},
131131
"dependencies": {
132-
"@react-aria/button": "^3.11.1",
133132
"@react-aria/collections": "3.0.0-alpha.7",
134-
"@react-aria/i18n": "^3.12.5",
135133
"@react-aria/interactions": "^3.23.0",
136134
"@react-aria/live-announcer": "^3.4.1",
137135
"@react-aria/tree": "3.0.0-beta.3",

packages/@react-spectrum/s2/src/TreeView.tsx

+19-19
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import {ActionButtonGroupContext} from './ActionButtonGroup';
1414
import {ActionMenuContext} from './ActionMenu';
1515
import {
16+
Button,
1617
ButtonContext,
1718
Collection,
1819
Provider,
@@ -36,9 +37,8 @@ import {isAndroid} from '@react-aria/utils';
3637
import {raw} from '../style/style-macro' with {type: 'macro'};
3738
import React, {createContext, forwardRef, isValidElement, JSXElementConstructor, ReactElement, useContext, useMemo, useRef} from 'react';
3839
import {Text, TextContext} from './Content';
39-
import {useButton} from '@react-aria/button';
40+
import {useLocale} from 'react-aria';
4041
import {useDOMRef} from '@react-spectrum/utils';
41-
import {useLocale} from '@react-aria/i18n';
4242

4343
interface S2TreeProps {
4444
// Only detatched is supported right now with the current styles from Spectrum
@@ -109,7 +109,7 @@ function TreeView(props: TreeViewProps, ref: DOMRef<HTMLDivElement>) {
109109

110110
let layout = useMemo(() => {
111111
return new UNSTABLE_ListLayout({
112-
rowHeight: isDetached ? 44 : 40
112+
rowHeight: isDetached ? 42 : 40
113113
});
114114
}, [isDetached]);
115115

@@ -257,7 +257,10 @@ const treeCellGrid = style({
257257
},
258258
borderTopWidth: {
259259
default: 0,
260-
isFirst: 1,
260+
isFirst: {
261+
default: 1,
262+
forcedColors: 0
263+
},
261264
isDetached: 1
262265
},
263266
borderBottomWidth: {
@@ -414,7 +417,7 @@ export const TreeViewItem = <T extends object>(props: TreeViewItemProps<T>) => {
414417
styles: style({size: fontRelative(20), flexShrink: 0})
415418
}],
416419
[ActionButtonGroupContext, {styles: treeActions}],
417-
[ActionMenuContext, {styles: treeActionMenu, isQuiet: true, 'aria-label': 'Actions'}]
420+
[ActionMenuContext, {styles: treeActionMenu, isQuiet: true}]
418421
]}>
419422
{content}
420423
</Provider>
@@ -450,29 +453,26 @@ const expandButton = style<ExpandableRowChevronProps>({
450453
isRTL: 'rotate(-90deg)'
451454
}
452455
},
453-
transition: 'default'
456+
transition: 'default',
457+
backgroundColor: 'transparent',
458+
borderStyle: 'none'
454459
});
455460

456461
function ExpandableRowChevron(props: ExpandableRowChevronProps) {
457-
let expandButtonRef = useRef<HTMLSpanElement>(null);
458-
// @ts-ignore - check back on this
462+
let expandButtonRef = useRef<HTMLButtonElement>(null);
459463
let [fullProps, ref] = useContextProps({...props, slot: 'chevron'}, expandButtonRef, ButtonContext);
460464
let {isExpanded, isDisabled} = fullProps;
461465
let {direction} = useLocale();
462466

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-
469467
return (
470-
<span
471-
{...buttonProps}
468+
<Button
469+
{...props}
472470
ref={ref}
471+
slot="chevron"
473472
// 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'})}>
476476
<Chevron
477477
className={style({
478478
scale: {
@@ -486,7 +486,7 @@ function ExpandableRowChevron(props: ExpandableRowChevronProps) {
486486
value: 'currentColor'
487487
}
488488
})({direction})} />
489-
</span>
489+
</Button>
490490
);
491491
}
492492

yarn.lock

-2
Original file line numberDiff line numberDiff line change
@@ -7894,9 +7894,7 @@ __metadata:
78947894
dependencies:
78957895
"@adobe/spectrum-tokens": "npm:^13.0.0-beta.53"
78967896
"@parcel/macros": "npm:^2.13.0"
7897-
"@react-aria/button": "npm:^3.11.1"
78987897
"@react-aria/collections": "npm:3.0.0-alpha.7"
7899-
"@react-aria/i18n": "npm:^3.12.5"
79007898
"@react-aria/interactions": "npm:^3.23.0"
79017899
"@react-aria/live-announcer": "npm:^3.4.1"
79027900
"@react-aria/test-utils": "npm:1.0.0-alpha.3"

0 commit comments

Comments
 (0)