diff --git a/packages/@react-spectrum/tree/src/TreeView.tsx b/packages/@react-spectrum/tree/src/TreeView.tsx index 6c28bca51f0..3ef1d65495c 100644 --- a/packages/@react-spectrum/tree/src/TreeView.tsx +++ b/packages/@react-spectrum/tree/src/TreeView.tsx @@ -197,7 +197,15 @@ const treeRowOutline = style({ position: 'absolute', insetStart: 0, insetEnd: 0, - top: 0, + top: { + default: 0, + isFocusVisible: '[-2px]', + isSelected: { + default: '[-1px]', + isFocusVisible: '[-2px]' + }, + isFirst: 0 + }, bottom: 0, pointerEvents: 'none', forcedColorAdjust: 'none', @@ -246,41 +254,44 @@ export const TreeViewItemContent = (props: SpectrumTreeViewItemContentProps) => return ( - {({isExpanded, hasChildItems, level, selectionMode, selectionBehavior, isDisabled, isSelected, isFocusVisible}) => ( -
- {selectionMode !== 'none' && selectionBehavior === 'toggle' && ( + {({isExpanded, hasChildItems, level, selectionMode, selectionBehavior, isDisabled, isSelected, isFocusVisible, state, id}) => { + let isFirst = state.collection.getFirstKey() === id; + return ( +
+ {selectionMode !== 'none' && selectionBehavior === 'toggle' && ( // TODO: add transition? - - )} -
- {/* TODO: revisit when we do async loading, at the moment hasChildItems will only cause the chevron to be rendered, no aria/data attributes indicating the row's expandability are added */} - {hasChildItems && } - - {children} - -
-
- )} + + )} +
+ {/* TODO: revisit when we do async loading, at the moment hasChildItems will only cause the chevron to be rendered, no aria/data attributes indicating the row's expandability are added */} + {hasChildItems && } + + {children} + +
+
+ ); + }} ); };