Bug 280630
| Summary: | [iOS] navigator.credentials.get fails on newly-opened tab in non-Safari browsers | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ali Juma <ajuma> |
| Component: | WebCore Misc. | Assignee: | pascoe <pascoe> |
| Status: | RESOLVED WONTFIX | ||
| Severity: | Normal | CC: | m_finkel, nitinmahendru, pascoe, webkit-bug-importer, wenson_hsieh, wilander |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | https://webauthn-new-tab-demo.glitch.me/ | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=226025 | ||
| Bug Depends on: | 226025 | ||
| Bug Blocks: | |||
Ali Juma
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/137133084>
John Wilander
Thanks for your report! I'll route this bug.
Ali Juma
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
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.