Nicolas Patin
04/27/2026, 4:05 PMWKWebview, and when I set the video fullscreen, the native iOS fullscreen was displayed below my Dialog.
I found a quick & dirty fix by manually updating the new Window level when the web view is visible.Nicolas Patin
04/27/2026, 4:05 PM/**
* Intercept fullscreen to display it above a CMP Dialog.
*/
@Composable
internal fun WebFullScreenInterceptor() {
val uiViewController = LocalUIViewController.current
val windowLevel = remember(uiViewController) {
uiViewController.view.window?.windowLevel ?: 0.0
}
DisposableEffect(windowLevel) {
val observer = WebFullScreenInterceptorObject(windowLevel)
observer.startObserving()
onDispose { observer.stopObserving() }
}
}
private class WebFullScreenInterceptorObject(private val cmpWindowLevel: Double): NSObject() {
private var observer: NSObjectProtocol? = null
fun startObserving() {
observer = NSNotificationCenter.defaultCenter.addObserverForName(
name = UIWindowDidBecomeVisibleNotification,
`object` = null,
queue = NSOperationQueue.mainQueue,
) { notification ->
val window = notification?.`object` as? UIWindow ?: return@addObserverForName
if(window.windowLevel > UIWindowLevelNormal) {
window.windowLevel = cmpWindowLevel + 1
}
}
}
fun stopObserving() {
observer?.let { NSNotificationCenter.defaultCenter.removeObserver(it) }
observer = null
}
}Andrei Salavei
04/28/2026, 7:10 AMChristopher Mederos
04/28/2026, 7:46 AMplacedAsOverlay = true if placing a native view in a dialog. Otherwise you get some awkward flashing from the UI punchout as the dialog is animating in