xamarin/Xamarin.Forms

[Bug] [Contacts] [iOS] Focus Handoff (and Address Book Search)

Open

#13,079 创建于 2020年11月17日

在 GitHub 查看
 (5 评论) (0 反应) (0 负责人)C# (5,644 star) (1,926 fork)batch import
a/entrya/pickere/3 :clock3:help wantedp/iOS 🍎up-for-grabs

描述

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();
  1. Have Picker and Entry on a Page.
  2. Use TextChanged event to listen for text changes on Entry using event handler code above.
  3. Load page, and type any text on Entry to trigger the handler.
  4. Select any contact in the Contacts dialog.
  5. Picker will not open after dialog has closed.
  6. 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

Reproduction Link

Archive.zip

贡献者指南