RESOLVED WONTFIX280630
[iOS] navigator.credentials.get fails on newly-opened tab in non-Safari browsers
https://bugs.webkit.org/show_bug.cgi?id=280630
Summary [iOS] navigator.credentials.get fails on newly-opened tab in non-Safari browsers
Ali Juma
Reported 2024-09-30 12:02:35 PDT
Steps to reproduce: 1) Open a new tab using window.open() 2) Call navigator.credentials.get() to trigger WebAuthn-based authentication in the new tab Expected result: WebAuthn-based authentication flow is triggered Actual result: On non-Safari browsers on iOS, the call to navigator.credentials.get fails. On Safari, the call succeeds and authentication UI is triggered. Here's a test page that demonstrates the bug: https://webauthn-new-tab-demo.glitch.me/ The underlying problem is bug 226025. In non-Safari browsers, document.hasFocus() is false until the user interacts with the page, but in Safari it's true from the beginning. But having focus is a prerequisite for navigator.credentials.get().
Attachments
Radar WebKit Bug Importer
Comment 1 2024-10-02 10:18:03 PDT
John Wilander
Comment 2 2024-10-03 15:10:27 PDT
Thanks for your report! I'll route this bug.
Ali Juma
Comment 3 2024-10-07 09:24:16 PDT
We've found in Chrome that we can make this work by calling `becomeFirstResponder` on the newly-created WKWebView. It might still be good for WebKit to handle this better somehow, since this will still be broken in other browsers (like Firefox on iOS), but please feel free to close this out if there's nothing more that WebKit can reasonably do.
pascoe@apple.com
Comment 4 2025-01-13 14:01:49 PST
For document.hasFocus() to work correctly, the WKWebView needs to be the firstResponder. This must be done by the application using the WKWebView, we understand this is a common bug and we are trying to improve documentation around this. This is similar to https://bugs.webkit.org/show_bug.cgi?id=269292.
Note You need to log in before you can comment on or make changes to this bug.