Bug 203299 - WKWebView: Username/Password autocomplete does not prompt on non-password inputs in Shadow DOM
Summary: WKWebView: Username/Password autocomplete does not prompt on non-password inp...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: Safari 13
Hardware: iPhone / iPad iOS 13
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
Depends on:
Blocks: 148695
  Show dependency treegraph
 
Reported: 2019-10-23 10:02 PDT by Liam DeBeasi
Modified: 2022-09-05 16:38 PDT (History)
14 users (show)

See Also:


Attachments
iOS app reproduction (56.37 KB, application/zip)
2019-10-23 10:02 PDT, Liam DeBeasi
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Liam DeBeasi 2019-10-23 10:02:39 PDT
Created attachment 381686 [details]
iOS app reproduction

When tapping into a non-password input in the Shadow DOM (for example, type="email") the "Passwords" autocomplete option does not appear. This bug only happens in WKWebView and does not happen in Safari.


Steps to reproduce:

1. Download the attached .zip, and run the extracted Xcode project on a physical iOS device.
2. Tap "Light DOM Username". Notice that the "Password" autocomplete option appears.
3. Tap "Shadow DOM Username". Notice that the "Password" autocomplete option does not appear.
4. Open the following CodePen in Safari on the iOS device: https://codepen.io/liamdebeasi/pen/ZEEeRPo (This is the example that is loaded in the WKWebView app)
5. Tap "Light DOM Username". Notice that the "Password" autocomplete option appears.
6. Tap "Shadow DOM Username". Notice that the "Password" autocomplete option appears.


Expected Results: 

I would expect that the "Passwords" autocomplete option appears for username/password inputs regardless of whether or not the input is in the Shadow DOM.
Comment 1 Radar WebKit Bug Importer 2019-10-23 10:43:15 PDT
<rdar://problem/56544687>
Comment 2 Daniel Ehrhardt 2020-06-20 15:51:20 PDT
More and more HTML Apps go to the App Store. Could someone please take a look into this Issue?
Comment 3 Calvin Ho 2020-10-01 21:46:42 PDT
any update on this bug? Thanks..
Comment 4 Ryosuke Niwa 2020-10-02 20:10:08 PDT
I think the bug is somewhere in AutofillElements. Interesting, this code also uses FocusController::previousFocusableElement/nextFocusableElement so it might be a duplicate of the bug 203292.
Comment 5 Daniel 2021-01-05 10:55:41 PST
Apple, please don't trivialize this. It really affects our users' experience when moving from web to the app experience.
Comment 6 Ryosuke Niwa 2021-01-05 14:17:20 PST
(In reply to Daniel from comment #5)
> Apple, please don't trivialize this. It really affects our users' experience
> when moving from web to the app experience.

Could you confirm that what you're experiencing is an issue with autofill within WKWebView in a third party app, and not about autofill in Safari?
Comment 7 Daniel 2021-01-05 14:24:00 PST
(In reply to Ryosuke Niwa from comment #6)
> Could you confirm that what you're experiencing is an issue with autofill
> within WKWebView in a third party app, and not about autofill in Safari?

Of course, it's about a Cordova app. Relevant dependencies:

- cordova-ios 6.1.1 https://github.com/apache/cordova-ios
- cordova-plugin-ionic-webview 5.0.0 https://github.com/ionic-team/cordova-plugin-ionic-webview
Comment 8 Liam DeBeasi 2021-02-02 06:54:09 PST
This issue appears to be fixed in iOS 14.5 beta 1. Thank you! (seems like it was the same issue that caused https://bugs.webkit.org/show_bug.cgi?id=203292)
Comment 9 Ryosuke Niwa 2021-02-02 10:19:04 PST
(In reply to Liam DeBeasi from comment #8)
> This issue appears to be fixed in iOS 14.5 beta 1. Thank you! (seems like it
> was the same issue that caused
> https://bugs.webkit.org/show_bug.cgi?id=203292)

That's a bit surprising. There is definitely code here which needs to be updated.
Comment 10 Ashley Medway 2021-02-02 10:22:06 PST
I am also seeing this fixed in iOS 14.5 beta 1
Comment 11 Teodor 2021-06-15 19:40:08 PDT
iOS 14.7 Public Beta 3
Issue is still present. Potentially a regression from 14.5 Beta 1.
Comment 12 Samuel Sheldon 2021-11-09 09:53:05 PST
I have tried this in iOS 15.1 and this issue is still not fixed. 

This is a critical feature for many developers, is there any way to get an estimate on a fix? Or at the very lease a temporary work around or solution we can use in the mean time?

Any update or assistance you can give will be helpful, thanks!
Comment 13 Ryosuke Niwa 2021-11-09 15:52:47 PST
Just to be clear, this issue tracks user/password autofill feature in non-Safari WKWebView clients. The issue in Safari is tracked by https://bugs.webkit.org/show_bug.cgi?id=172567.
Comment 14 Samuel Sheldon 2021-11-10 05:55:20 PST
(In reply to Ryosuke Niwa from comment #13)
> Just to be clear, this issue tracks user/password autofill feature in
> non-Safari WKWebView clients. The issue in Safari is tracked by
> https://bugs.webkit.org/show_bug.cgi?id=172567.

Good morning Ryosuke Niwa,

you are right I was looking for the Safari based WKWebView bug. Thank you for passing it along to me! I will make my comments there
Comment 15 Brent Fulgham 2022-02-10 20:40:26 PST
This is actually:
<rdar://27205947>
Comment 16 Ryosuke Niwa 2022-02-11 10:37:49 PST
(In reply to Brent Fulgham from comment #15)
> This is actually:
> <rdar://27205947>

Oh, this is not that! That radar is about Safari. This bug is about autofill feature that exist in WKWebView, not Safari.
Comment 17 Wolf Walter 2022-03-22 06:22:21 PDT
This bug does affect my iOS app build with Ionic, Angular and Capacitor.
Comment 18 Ryosuke Niwa 2022-07-03 00:20:02 PDT
(In reply to Ryosuke Niwa from comment #9)
> (In reply to Liam DeBeasi from comment #8)
> > This issue appears to be fixed in iOS 14.5 beta 1. Thank you! (seems like it
> > was the same issue that caused
> > https://bugs.webkit.org/show_bug.cgi?id=203292)
> 
> That's a bit surprising. There is definitely code here which needs to be
> updated.

Oh, I was misunderstanding this problem. WKWebView's autofill feature is indeed fixed by that code change because we use the same functions to find autofillable elements.
Comment 19 Ryosuke Niwa 2022-07-03 00:29:40 PDT
Pull request: https://github.com/WebKit/WebKit/pull/2037
Comment 20 Ryosuke Niwa 2022-07-03 00:30:06 PDT
Let's add a test case so that this won't regress over time.
Comment 21 EWS 2022-07-03 13:18:10 PDT
Committed 252105@main (1671a015250d): <https://commits.webkit.org/252105@main>

Reviewed commits have been landed. Closing PR #2037 and removing active labels.
Comment 22 Ryosuke Niwa 2022-07-03 13:22:07 PDT
The bug has been fixed in https://commits.webkit.org/r269059.

Autofill not functioning across shadow boundaries in Safari is tracked by the bug 172567.
Comment 23 Mischa 2022-09-05 16:00:21 PDT
Does this fix also solve https://bugs.webkit.org/show_bug.cgi?id=226023
Comment 24 Ryosuke Niwa 2022-09-05 16:38:26 PDT
(In reply to Mischa from comment #23)
> Does this fix also solve https://bugs.webkit.org/show_bug.cgi?id=226023

No.