refactor(core): add stub for addEventListener in useWindow

This commit is contained in:
braks
2023-10-30 13:36:07 +01:00
committed by Braks
parent 4ae371afbb
commit 2a407f59e3
4 changed files with 27 additions and 24 deletions
+4 -3
View File
@@ -59,13 +59,14 @@ export function clampPosition(position: XYPosition, extent: CoordinateExtent): X
export function getHostForElement(element: HTMLElement): Document {
const doc = element.getRootNode() as Document
const window = useWindow()
if ('elementFromPoint' in doc) {
return doc
} else {
return window.document
}
const window = useWindow()
return window.document
}
// todo: refactor generic to use MaybeElement