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

Function getItemElement

packages/react-aria/src/selection/utils.ts:30–40  ·  view source on GitHub ↗
(
  collectionRef: RefObject<HTMLElement | null>,
  key: Key
)

Source from the content-addressed store, hash-verified

28}
29
30export function getItemElement(
31 collectionRef: RefObject<HTMLElement | null>,
32 key: Key
33): Element | null | undefined {
34 let selector = `[data-key="${CSS.escape(String(key))}"]`;
35 let collection = collectionRef.current?.dataset.collection;
36 if (collection) {
37 selector = `[data-collection="${CSS.escape(collection)}"]${selector}`;
38 }
39 return collectionRef.current?.querySelector(selector);
40}
41
42const collectionMap = new WeakMap<Collection<any>, string>();
43export function useCollectionId(collection: Collection<any>): string {

Callers 5

isReversedMethod · 0.90
getItemRectMethod · 0.90
navigateToKeyFunction · 0.90
onFocusFunction · 0.90
useSelectableCollectionFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected