This commit is contained in:
2025-11-14 02:35:17 +01:00
parent 6f4ff68062
commit a3c5494bf7
53 changed files with 269 additions and 340 deletions
+1 -5
View File
@@ -165,13 +165,9 @@ const getEventTargetElement = (event?: PointerEventLike | null): Element | null
if (!event) {
return null;
}
const ElementCtor = typeof window !== 'undefined' ? window.Element : null;
if (!ElementCtor) {
return null;
}
const nativeEvent = 'nativeEvent' in event ? (event as ReactPointerEvent).nativeEvent : null;
const candidate = (event.target as Element | null) || (nativeEvent ? (nativeEvent.target as Element | null) : null);
return candidate instanceof ElementCtor ? candidate : null;
return candidate instanceof Element ? candidate : null;
};
const useDocumentDrag = (options: UseDocumentDragOptions) => {