MCPcopy Create free account
hub / github.com/adobe/react-spectrum / RootDropIndicator

Function RootDropIndicator

packages/react-aria-components/src/Tree.tsx:1238–1263  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1236const TreeDropIndicatorForwardRef = forwardRef(TreeDropIndicator);
1237
1238function RootDropIndicator() {
1239 let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);
1240 let ref = useRef<HTMLDivElement>(null);
1241 // oxlint-disable-next-line react/react-compiler
1242 let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!(
1243 {
1244 target: {type: 'root'}
1245 },
1246 dropState!,
1247 ref
1248 );
1249 let isDropTarget = dropState!.isDropTarget({type: 'root'});
1250 let {visuallyHiddenProps} = useVisuallyHidden();
1251
1252 if (!isDropTarget && dropIndicatorProps['aria-hidden']) {
1253 return null;
1254 }
1255
1256 return (
1257 <div role="row" aria-hidden={dropIndicatorProps['aria-hidden']} style={{position: 'absolute'}}>
1258 <div role="gridcell">
1259 <div role="button" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />
1260 </div>
1261 </div>
1262 );
1263}
1264
1265export interface TreeSectionProps<T> extends SectionProps<T>, DOMRenderProps<'div', undefined> {}
1266

Callers

nothing calls this directly

Calls 2

useVisuallyHiddenFunction · 0.90
isDropTargetMethod · 0.80

Tested by

no test coverage detected