xamarin/Xamarin.Forms

[Bug] [Xamarin.Forms] [Android] Picker editable with IsEnabled == False

Open

#8,178 opened on Oct 23, 2019

 (2 comments) (0 reactions) (0 assignees)C# (1,926 forks)batch import
help wantedinactivep/Androidt/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

A disabled picker is still editable.

Android's keyboard has 'next' and 'back' buttons that look like right and left arrows, respectively. These can be used like a 'tab' to tab between controls based on their tab order. While a disabled picker cannot be selected directly, the user can select another element and use the 'next' or 'back' buttons to navigate to and focus the picker, allowing the user to change the picker's selected value.

Steps to Reproduce

  1. Create an entry followed by a picker
  2. Set the picker's IsEnabled to False
  3. Select the entry (virtual keyboard opens)
  4. Click the 'Next' button (right arrow) on the virtual keyboard.
  5. Notice how the picker is now selected and will allow you to select an item.
  6. Select an item from the list and observe how the picker now reflects the selected value.
   <StackLayout>
        <Entry Text="Entry" IsEnabled="True"/>
        <Picker Title="Picker" IsEnabled="False">
            <Picker.Items>
                <x:String>100</x:String>
                <x:String>200</x:String>
            </Picker.Items>
        </Picker>
    </StackLayout>

Expected Behavior

With the entry selected, the 'next' button should not even focus the picker. However, even if the picker can be focused, it should not be allowed to change value.

Actual Behavior

A disabled picker's selected value can be changed.

Basic Information

  • Version with issue: 4.3.0.908675
  • Last known good version: Unknown
  • IDE: VS 2019 16.3.5
  • Platform Target Frameworks:
    • Android: 9
  • Affected Devices: Galaxy Tab A

Additional information

It is worth mentioning that I have found the Entry has a similar issue. A disabled entry can be focused with the 'Next' and 'Back' buttons on the Android keyboard. However, the disabled entry cannot be edited even if it is focused. Perhaps the issue is deeper than in the Picker itself.

Screenshots

EntrySelected

PickerSelected

PickerEdited

Contributor guide