<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>280630</bug_id>
          
          <creation_ts>2024-09-30 12:02:35 -0700</creation_ts>
          <short_desc>[iOS] navigator.credentials.get fails on newly-opened tab in non-Safari browsers</short_desc>
          <delta_ts>2025-01-13 14:02:26 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=226025</see_also>
          <bug_file_loc>https://webauthn-new-tab-demo.glitch.me/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>226025</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ali Juma">ajuma</reporter>
          <assigned_to name="pascoe@apple.com">pascoe</assigned_to>
          <cc>m_finkel</cc>
    
    <cc>nitinmahendru</cc>
    
    <cc>pascoe</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
    
    <cc>wilander</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2064305</commentid>
    <comment_count>0</comment_count>
    <who name="Ali Juma">ajuma</who>
    <bug_when>2024-09-30 12:02:35 -0700</bug_when>
    <thetext>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&apos;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&apos;s true from the beginning. But having focus is a prerequisite for navigator.credentials.get().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2064890</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-10-02 10:18:03 -0700</bug_when>
    <thetext>&lt;rdar://problem/137133084&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2065277</commentid>
    <comment_count>2</comment_count>
    <who name="John Wilander">wilander</who>
    <bug_when>2024-10-03 15:10:27 -0700</bug_when>
    <thetext>Thanks for your report! I&apos;ll route this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2065873</commentid>
    <comment_count>3</comment_count>
    <who name="Ali Juma">ajuma</who>
    <bug_when>2024-10-07 09:24:16 -0700</bug_when>
    <thetext>We&apos;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&apos;s nothing more that WebKit can reasonably do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2086874</commentid>
    <comment_count>4</comment_count>
    <who name="pascoe@apple.com">pascoe</who>
    <bug_when>2025-01-13 14:01:49 -0800</bug_when>
    <thetext>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.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>