File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed
Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -26,17 +26,16 @@ if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
2626 )
2727}
2828
29- const isWindows = ostype ( ) === "windows"
30- if ( isWindows ) {
31- const originalGetComputedStyle = window . getComputedStyle
32- window . getComputedStyle = ( ( elt : Element , pseudoElt ?: string | null ) => {
33- if ( ! ( elt instanceof Element ) ) {
34- // WebView2 can call into Floating UI with non-elements; fall back to a safe element.
35- return originalGetComputedStyle ( document . documentElement , pseudoElt ?? undefined )
36- }
37- return originalGetComputedStyle ( elt , pseudoElt ?? undefined )
38- } ) as typeof window . getComputedStyle
39- }
29+ // Floating UI can call getComputedStyle with non-elements (e.g., null refs, virtual elements).
30+ // This happens on all platforms (WebView2 on Windows, WKWebView on macOS), not just Windows.
31+ const originalGetComputedStyle = window . getComputedStyle
32+ window . getComputedStyle = ( ( elt : Element , pseudoElt ?: string | null ) => {
33+ if ( ! ( elt instanceof Element ) ) {
34+ // Fall back to a safe element when a non-element is passed.
35+ return originalGetComputedStyle ( document . documentElement , pseudoElt ?? undefined )
36+ }
37+ return originalGetComputedStyle ( elt , pseudoElt ?? undefined )
38+ } ) as typeof window . getComputedStyle
4039
4140let update : Update | null = null
4241
You can’t perform that action at this time.
0 commit comments