question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: ios, autofill not working properly in wkwebview

See original GitHub issue

Bug Report

I believe it is the same issue as #22682 and #22757, with reproduction instruction.

Ionic version:

[ ] 4.x [x] 5.x

Current behavior: On a login form using ion-input, the iOS Keychain does fill username and password. But the secondary ion-input item does not see changes. By “secondary” I mean the one that was not touched.

For example:

  1. Touch “email” input
  2. Autofill with iOS Keychain
  3. email and password are filled but only the ion-input email field is updated. The value of ion-input password is empty.

Or:

  1. Touch the “password” input
  2. Autofill with iOS Keychain
  3. email and password are filled but only the ion-input password field is updated. The value of ion-input email is empty.

Expected behavior: Ion-Input should see the change of the underlying input item.

Steps to reproduce:

Sample project based on ionic starter blank: https://github.com/florian72810/ion-input-password-ios-keychain

The issue happens on real device or simulator, I checked on “Simulator iPod touch 7th Generation - iOS 14.5”, “Simulator iPod touch 7th Generation - iOS 13.0”, and also on real device “iPhone XS Max - iOS 14.5”.

The iOS Keychain need to have some content. You have to enable it first and put some data. (see screenshot at bottom)

If you are using a simulator, you have to disconnect the hardware keyboard in order to see the visual keyboard: I/O > Keyboard > Connect Hardware Keyboard (unchecked).

On the following video, you can see the bug.

  • touch “password” input
  • select “Passwords” in visual keyboard
  • select something from the keychain
  • now both fields show data, but you can see that only ion-input email value is still empty.

  • write the letter “a” in the end of email input
  • now the ion-input email value has data: the data from the keychain (here ‘demo’) and the letter added (here ‘a’)

https://user-images.githubusercontent.com/20518933/118987623-1e016c80-b989-11eb-890e-7611df8c0882.mp4

Other information:

  • The bug also happens with Ionic/Vue.
  • I have not tested with Capacitor.
  • I am 99% sure that it was working as expected before, around September 2020.

The AppStore validation team seem to be using the keychain to test app because they refused my app yesterday due to this bug.

It is still possible to access the native input field to bypass this bug.

Ionic info:


Ionic:

   Ionic CLI                     : 6.12.3 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.6.7
   @angular-devkit/build-angular : 0.1102.13
   @angular-devkit/schematics    : 11.2.13
   @angular/cli                  : 11.2.13
   @ionic/angular-toolkit        : 3.1.1

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : ios 6.2.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 4 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 1.3.0

System:

   Android SDK Tools : 26.1.1 (/Users/foxer/Library/Android/sdk)
   ios-deploy        : 1.11.4
   ios-sim           : 8.0.2
   NodeJS            : v14.15.4 (/Users/foxer/.nvm/versions/node/v14.15.4/bin/node)
   npm               : 6.14.10
   OS                : macOS Big Sur
   Xcode             : Xcode 12.5 Build version 12E262

Simulator Screen Shot - iPod touch (7th generation) - 2021-05-20 at 16 26 55

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
florian72810commented, May 21, 2021

The workaround works 👍

1reaction
liamdebeasicommented, Jul 8, 2022

Hi everyone,

I am posting here again as I am merging a related thread.

This thread is tracking a bug in WKWebView where the autofill feature in iOS is not updating the value property in ion-input. This bug impacts Cordova/Capacitor apps but does not impact apps running in mobile Safari.

I will post here when a fix has been shipped in iOS. In the meantime, if anyone has links to production apps that are impacted by this bug, please feel free to post them. This can sometimes help get WebKit bugs fixed faster.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why autofill not working in WKWebView? - Apple Developer
After configuration, autofill working in the mobile Safari browser but not in the in-app-browser (WKWebView). May I know if this is supported by...
Read more >
HTML Input autocomplete not working in WKWebview
The autofill that I wanted was for the WKWebView to autocomplete a saved username and password for easy login. However, this could present...
Read more >
203299 – WKWebView: Username/Password autocomplete ...
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 ...
Read more >
JavaScript Manipulation on iOS Using WebKit | Capital One
After iOS 8, however, Apple deprecated UIWebView for WKWebView and introduced ... that this is only meant to be used for development and...
Read more >
Web Views in Xamarin.iOS - Microsoft Learn
Direct usage of UIWebView by your application. Start by removing your use of UIWebView , for example, replace it with the newer WKWebView...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found