[Bug] [Contacts] [iOS] Focus Handoff (and Address Book Search)
#13,079 opened on Nov 17, 2020
Description
Description
This issue relates to new Contacts API and Contacts API PR.
Scenario
In a management page for group members, a list of Xamarin.Forms.Entry listens for text changes.
On text change, two types of auto-complete is possibly triggered:
- if text begins with "@", it does a handle search for existing users.
- else, Contacts.PickContactAsync() is used to open Contacts dialog and select a Contact.
If using the Contacts dialog, a Xamarin.Forms.Picker is populated with emails and phone numbers of the selected Contact.
After the Picker options are populated, the Picker is given focus in order to open it.
Once a Picker item is selected, the selected item text is used to auto-complete the text in triggering Entry.
Issue
On iOS, when triggered from an Entry, the Contacts dialog is not handing off focus correctly. This seems to be an issue regardless of whether or not the Entry is in a ListView.
Focus handoff from Entry -> Contacts dialog ->Picker works on Android.
Focus handoff works on iOS if the element that triggers the Contacts dialog is a button:
Button -> Contacts dialog -> Picker
Steps to Reproduce
Sample event handler code (works in Android and iOS buttons but not for iOS entries):
// Open Contacts dialog to pick a contact first
var contact = await Contacts.PickContactAsync();
if (contact == null) {
return;
}
// Populate Picker
// using selected contact's emails and phone numbers
_Picker.Items.Clear();
foreach (var e in contact.Emails) {
_Picker.Items.Add(e.EmailAddress);
}
foreach (var p in contact.Numbers) {
_Picker.Items.Add(p.PhoneNumber);
}
// Give focus to Picker so user can select an email/phone number
_Picker.Focus();
- Have
PickerandEntryon aPage. - Use
TextChangedevent to listen for text changes onEntryusing event handler code above. - Load page, and type any text on
Entryto trigger the handler. - Select any contact in the Contacts dialog.
Pickerwill not open after dialog has closed.- No exceptions are thrown.
Expected Behavior
After selecting a contact, Contacts dialog closes, and Picker opens.
Actual Behavior
After selecting a contact, Contacts dialog closes, but Picker does not open. No errors/exceptions are thrown.
Basic Information
- Version with issue: Xamarin.Essentials 1.6.0-pre4
- Last known good version: n/a as this is a new feature
- IDE: VisualStudio for Mac 8.8 (build 2913)
- Platform Target Frameworks:
- iOS: 13.7
- Nuget Packages:
- Xamarin.Forms 4.8.0.1560
- Xamarin.Essentials 1.6.0-pre4
- Affected Devices: iPhone 7 Plus
Screenshots
n/a