[Webkit-unassigned] [Bug 226025] New: document and window does not initially have focus in WKWebView
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu May 20 09:20:40 PDT 2021
https://bugs.webkit.org/show_bug.cgi?id=226025
Bug ID: 226025
Summary: document and window does not initially have focus in
WKWebView
Product: WebKit
Version: Safari 14
Hardware: iPhone / iPad
OS: iOS 14
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: raon0211 at gmail.com
Created attachment 429179
--> https://bugs.webkit.org/attachment.cgi?id=429179&action=review
videos that show the difference between mobile safari and wkwebview
When loading webpages in WKWebView, document and window does not have initial focus.
(`document.hasFocus()` returns `false` initially.)
After receiving some user interactions such as touch,
the `window`'s focus event fires and `document.hasFocus()` starts to return `true`.
This is strange since in Mobile Safari, `document` and `window` have focus from the beginning.
Since JavaScript libraries such as SWR or React Query revalidates the AJAX requests on window's focus events,
this leads to extra XHR requests to fire when accessing sites using such libraries.
The videos in the attached ZIP file below show the difference of Mobile Safari and WKWebView:
In Mobile Safari, `document` and `window` immediately have focus.
In WKWebView (Facebook In-app Web Browser), `document` and `window` does not have focus until user touch.
The test page used in the video is https://service-alpha.toss.im/test/focus-test.
---
Thread in WebKit slack: https://webkit.slack.com/archives/CU5LWFM28/p1621516267010100
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210520/3b73e38b/attachment-0001.htm>
More information about the webkit-unassigned
mailing list