This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.
[Android] Calling Focus on all Pickers running an API 28 devices no longer opens Picker #5159
Closed
Description
Description
When using API Level 28, calling Focus on a DatePicker with Visible set to false does not show the date picker dialog.
Prior to this PR https://github.com/xamarin/Xamarin.Forms/pull/4344/files#diff-446294d29d78ca8d84e4c0ddc20bbc07L132 the Picker was opened as part of the FocusRequestedEvent. PR #4344 brought DatePicker inline with the other pickers by changing it to trigger a Click on the control which then would trigger the click listener to open the picker.
On API 28 FocusRequestedEvent is still called so there is still an opportunity to react to this. The difference on API 28 is that the Focus request fails so the Click Listener never actually fires.
Possible fix ideas
- force it to focus anyway. Maybe this is a bad idea? On iOS if the control isn't visible it's still able to be set as a First Responder so this would bring it inline with iOS
- change all the pickers to open the dialog from the FocusRequestedEvent. If this is done then make sure to test what [Android] fixes Picker list showing up incorrectly when focus is set on other controls #4344 fixed
Steps to Reproduce
- Add a date picker and a button on a Forms page. Set the visibility of the date picker to false
- Use the button to call Focus on the date picker.
- On API 27 and lower the dialog is shown. Not on API 28.
Expected Behavior
DatePicker dialog is shown.
Actual Behavior
Nothing happens.
Basic Information
- Version with issue: 4.0.0.135214-pre4
- Last known good version: Unknown
- IDE: Visual Studio 2019 Windows
- Platform Target Frameworks:
- Android: API 28
- Android Support Library Version:
- Nuget Packages:
- Affected Devices: Android
Screenshots
n/a