summaryrefslogtreecommitdiffhomepage
path: root/packages/desktop/src
diff options
context:
space:
mode:
authorEric Guo <[email protected]>2026-01-17 19:45:31 +0800
committerGitHub <[email protected]>2026-01-17 05:45:31 -0600
commitc4e4f2a0586df665988cd4afcecb810df4995627 (patch)
tree9ae54cef4e033a860ab1a1a0248110fa51329702 /packages/desktop/src
parent2729705594b9429ce44cf371dbf7268ac3457d8b (diff)
downloadopencode-c4e4f2a0586df665988cd4afcecb810df4995627.tar.gz
opencode-c4e4f2a0586df665988cd4afcecb810df4995627.zip
fix(desktop): Added a Windows-only guard that makes window.getComputedStyle fall back to document.documentElement (#9054)
Diffstat (limited to 'packages/desktop/src')
-rw-r--r--packages/desktop/src/index.tsx12
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/desktop/src/index.tsx b/packages/desktop/src/index.tsx
index 7a46ba8cd..8398f4577 100644
--- a/packages/desktop/src/index.tsx
+++ b/packages/desktop/src/index.tsx
@@ -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
const createPlatform = (password: Accessor<string | null>): Platform => ({