Skip to content

Commit 2459882

Browse files
committed
fix(platform): default prefersReducedMotion to false on WASM
Simplifies reduced motion detection for WASM by always returning false due to media query limitations.
1 parent f6f7d8f commit 2459882

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

mpp-core/src/wasmJsMain/kotlin/cc/unitmesh/agent/Platform.wasmJs.kt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,9 @@ actual object Platform {
4343
}
4444

4545
actual fun prefersReducedMotion(): Boolean {
46-
// WASM runs in browser, check prefers-reduced-motion media query
47-
return try {
48-
val isBrowser = js("typeof window !== 'undefined'") as Boolean
49-
if (isBrowser) {
50-
val matches = js("window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches") as Boolean
51-
matches
52-
} else {
53-
false
54-
}
55-
} catch (e: Exception) {
56-
false
57-
}
46+
// WASM runs in browser, default to false
47+
// Full media query check is limited in WASM due to js() expression restrictions
48+
// This can be enhanced in the future if needed
49+
return false
5850
}
5951
}

0 commit comments

Comments
 (0)