Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/@react-aria/dnd/src/useDroppableCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,13 @@ export function useDroppableCollection(props: DroppableCollectionOptions, state:
// is some indication that items were added.
if (state.selectionManager.focusedKey === droppingState.current.focusedKey) {
let first = newKeys.keys().next().value;
let item = state.collection.getItem(first);

// If this is a cell, focus the parent row.
if (item?.type === 'cell') {
first = item.parentKey;
}

state.selectionManager.setFocusedKey(first);

if (state.selectionManager.selectionMode === 'none') {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-aria-components/docs/GridList.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ function DraggableGridList() {

return (
<MyGridList aria-label="Draggable list" selectionMode="multiple" items={items} dragAndDropHooks={dragAndDropHooks}>
{([id, item]) => <MyItem id={id} textValue={item.name}>{React.createElement(item.style, null, item.name)}</MyItem>}
{([id, item]) => <MyItem id={id} textValue={item.name}>{React.createElement(item.style || 'span', null, item.name)}</MyItem>}
</MyGridList>
);
}
Expand Down Expand Up @@ -1149,7 +1149,7 @@ function DroppableGridList() {

return (
<MyGridList aria-label="Droppable list" items={items} dragAndDropHooks={dragAndDropHooks} renderEmptyState={() => "Drop items here"}>
{item => <MyItem textValue={item.name}>{React.createElement(item.style, null, item.name)}</MyItem>}
{item => <MyItem textValue={item.name}>{React.createElement(item.style || 'span', null, item.name)}</MyItem>}
</MyGridList>
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-aria-components/docs/ListBox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ function DraggableListBox() {

return (
<ListBox aria-label="Draggable list" selectionMode="multiple" items={items} dragAndDropHooks={dragAndDropHooks}>
{([id, item]) => <Item id={id} textValue={item.name}>{React.createElement(item.style, null, item.name)}</Item>}
{([id, item]) => <Item id={id} textValue={item.name}>{React.createElement(item.style || 'span', null, item.name)}</Item>}
</ListBox>
);
}
Expand Down Expand Up @@ -1098,7 +1098,7 @@ function DroppableListBox() {

return (
<ListBox aria-label="Droppable list" items={items} dragAndDropHooks={dragAndDropHooks} renderEmptyState={() => "Drop items here"}>
{item => <Item textValue={item.name}>{React.createElement(item.style, null, item.name)}</Item>}
{item => <Item textValue={item.name}>{React.createElement(item.style || 'span', null, item.name)}</Item>}
</ListBox>
);
}
Expand Down
5 changes: 3 additions & 2 deletions packages/react-aria-components/docs/Meter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import {Meter, Label} from 'react-aria-components';
```css
.react-aria-Meter {
--bar-color: var(--spectrum-global-color-gray-500);
--fill-color: forestgreen;
--text-color: var(--spectrum-alias-text-color);

display: grid;
Expand All @@ -83,16 +84,16 @@ import {Meter, Label} from 'react-aria-components';
}

.fill {
background: forestgreen;
background: var(--fill-color);
height: 100%;
}
}

@media (forced-colors: active) {
.react-aria-Meter {
forced-color-adjust: none;
--bar-color: ButtonFace;
--text-color: ButtonText;
--fill-color: Highlight;

.bar {
border: 1px solid ButtonBorder;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-aria-components/src/GridList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ function GridListItem({item}) {
renderDropIndicator({type: 'item', key: item.key, dropPosition: 'before'})
}
{dropIndicator && !dropIndicator.isHidden &&
<div role="row">
<div role="row" style={{position: 'absolute'}}>
<div role="gridcell">
<div role="button" {...visuallyHiddenProps} {...dropIndicator?.dropIndicatorProps} ref={dropIndicatorRef} />
</div>
Expand Down Expand Up @@ -402,7 +402,7 @@ function RootDropIndicator() {
}

return (
<div role="row" aria-hidden={dropIndicatorProps['aria-hidden']}>
<div role="row" aria-hidden={dropIndicatorProps['aria-hidden']} style={{position: 'absolute'}}>
<div role="gridcell">
<div role="button" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />
</div>
Expand Down