xamarin/Xamarin.Forms

`Focus` is not consistent on all platforms

Aperta

#5616 aperta il 19 mar 2019

 (2 commenti) (0 reazioni) (0 assegnatari)C# (1926 fork)batch import
e/7 :clock7:help wantedi/highinactivem/high impact :black_large_square:p/Androidp/iOS 🍎partner/cat 😻t/bug :bug:up-for-grabs

Metriche repository

Star
 (5644 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Description

This is a larger issue that requires some discussion. The basic summary is this:

All Xamarin.Forms controls are VisualElements, which contains a basic set of properties and events that should work on any VisualElement.

However, the Focus method is not functional on many mobile controls (e.g., Button, WebView) because there is no native option to put focus on such native objects.

Problems:

  1. For many reasons, a11y included, customers would like to put the focus on a Button (or other element) programmatically, and they are currently unable to do so on mobile platforms. Can we do this somehow?

  2. If the answer is No, then should we obsolete the Focus method from VisualElement and move it to a Focusable interface that we can then apply only to elements that are able to be focused? What do we do when that is platform specific?

  3. Moreover, the Focus method is supposed to return a bool value that indicates whether the platform was able to successfully focus the element; in the case of Button, this is erroneously returning true.

Guida contributor