Shared worker inside WKWebView stops working when focus out

I use the WKWebView to show my content. And inside it, I also used a shared worker to run my task. And while I move focus out, the WKWebview is still working but the tasks inside shared worker stops. Is this by design or a bug? Do you have any suggestions to handle this situation to let the task inside shared worker to continue while focus changes.

Shared worker inside WKWebView stops working when focus out
 
 
Q