Dismissing AutoFill Extension on iPad makes the host app unresponsive

75 Views Asked by At

I'm developing an AutoFill Extension (AppEx) and stumbled upon the following bug, which happens on iPad only.

This bug is reproducible on device only (not reproducible on simulator) and can be observed e.g. in the Dashlane app

Steps to reproduce:

  1. Enable AutoFill for the app in question in the iOS Settings -> Passwords -> Password AutoFill
  2. Open an app, e.g. LinkedIn or Netflix
  3. Open AutoFill App Extension (do not use QuickType if suggested)
  4. Try to dismiss the AutoFill Modal view by tapping outside of the view (do not dismiss with the Cancel button)
  5. Now the host app (LinkedIn or Netflix) becomes unresponsive.

The whole demo video of the issue. After the AutoFill view is dismissed, it's not possible to activate any of the text fields in the LinkedIn app:

Demo Video of the AutoFill Issue

Potential solutions

I've found out that the root cause of the app being unresponsive is that the system still assumes that the "control" is with the AutoFill extension and not with the host app, even when the AutoFill view is dismissed.

I've figured this out by triggering a method call after some time after presenting the AutoFill Controller, so that the whole sequence became as follows (timecodes are just to illustrate the order and speed with which the events happen):

  1. Present AutoFill Controller (0:00)
  2. Tap outside of the AutoFill Controller (0:01)
  3. Method call (0:02)

The method call was one of those (any of them could work):

    @objc private func close(_ sender: AnyObject?) {
        self.extensionContext.completeExtensionConfigurationRequest()
    }
    
    @objc private func cancel(_ sender: AnyObject?) {
        self.extensionContext.cancelRequest(withError: NSError(domain: ASExtensionErrorDomain, code: ASExtensionError.userCanceled.rawValue))
    }

So, if the extensionContext is given an information that the user has cancelled the AutoFill request, the system correctly gives the control back to the host app (i.e. LinkedIn) in this case.

The question is how can I observe the "tap outside of the modal screen" event and call one of the methods accordingly?

0

There are 0 best solutions below