fix(desktop): Added a Windows-only guard that makes window.getComputedStyle fall back to document.documentElement (#9054)
This commit is contained in:
parent
2729705594
commit
c4e4f2a058
1 changed files with 12 additions and 0 deletions
|
|
@ -26,6 +26,18 @@ if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isWindows = ostype() === "windows"
|
||||||
|
if (isWindows) {
|
||||||
|
const originalGetComputedStyle = window.getComputedStyle
|
||||||
|
window.getComputedStyle = ((elt: Element, pseudoElt?: string | null) => {
|
||||||
|
if (!(elt instanceof Element)) {
|
||||||
|
// WebView2 can call into Floating UI with non-elements; fall back to a safe element.
|
||||||
|
return originalGetComputedStyle(document.documentElement, pseudoElt ?? undefined)
|
||||||
|
}
|
||||||
|
return originalGetComputedStyle(elt, pseudoElt ?? undefined)
|
||||||
|
}) as typeof window.getComputedStyle
|
||||||
|
}
|
||||||
|
|
||||||
let update: Update | null = null
|
let update: Update | null = null
|
||||||
|
|
||||||
const createPlatform = (password: Accessor<string | null>): Platform => ({
|
const createPlatform = (password: Accessor<string | null>): Platform => ({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue