WkWebView breaks with isElementEnabled preference set to true on fullscreen pause

I have an webview that loads videos in it, we would like to be able to fullscreen our videos, so we use the fullscreen preference in the documentation however when it is set to true, upon fullscreening a video then pausing it, the entire video player will disappear.

You can exit fullscreen and attempt to fullscreen the video player once again, however upon doing this the entire app view will now disappear and you'll see your desktop background (or whatever is currently behind your app). This behavior seems consistent across multiple websites with the current app. I have setup a sample project you can test here

The Main error that seems to trigger to the console is this. I have not been able to find a solution to, maybe I am simply missing something here. I am on Sequoia 15.2 for Mac.

Attempting to update all DD element frames, but the bounds or contentsRect are invalid. Bounds: X: 0.00 Y: 0.00, W: 0.00 H: 0.00, contentsRect: X: 0.00 Y: 0.00, W: 1.00 H: 1.00 , skipping
Answered by AHDev in 814097022

SOLVED: To anybody else that encounters the issue, it seems the way I was setting my constraints was causing the issue. initially from my linked project, I was setting the constraints like so

NSLayoutConstraint.activate([
            MainWebView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
            MainWebView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
            MainWebView.topAnchor.constraint(equalTo: view.topAnchor),
            MainWebView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
        ])
        

Instead, I just set MainWebView = WKWebView(frame: view.bounds, configuration: webConfiguration) as well as MainWebView.translatesAutoresizingMaskIntoConstraints to true and MainWebView.autoresizingMask = [.width, .height] and this seems to work without any errors. I hope this is helpful to someone out there!

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report and post the FB number here once you do. Bug Reporting: How and Why? has tips on creating your bug report.

Accepted Answer

SOLVED: To anybody else that encounters the issue, it seems the way I was setting my constraints was causing the issue. initially from my linked project, I was setting the constraints like so

NSLayoutConstraint.activate([
            MainWebView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
            MainWebView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
            MainWebView.topAnchor.constraint(equalTo: view.topAnchor),
            MainWebView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
        ])
        

Instead, I just set MainWebView = WKWebView(frame: view.bounds, configuration: webConfiguration) as well as MainWebView.translatesAutoresizingMaskIntoConstraints to true and MainWebView.autoresizingMask = [.width, .height] and this seems to work without any errors. I hope this is helpful to someone out there!

WkWebView breaks with isElementEnabled preference set to true on fullscreen pause
 
 
Q