reakit
Version:
Toolkit for building accessible rich web apps with React
12 lines (10 loc) • 359 B
text/typescript
import { Item } from "./types";
import { isElementPreceding } from "./isElementPreceding";
export function findDOMIndex(items: Item[], item: Item) {
return items.findIndex((currentItem) => {
if (!currentItem.ref.current || !item.ref.current) {
return false;
}
return isElementPreceding(item.ref.current, currentItem.ref.current);
});
}