Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
[iOS] Picker - Fix VoiceOver reading reading row twice (#14209)
Browse files Browse the repository at this point in the history
* only reload picker on collection change

* Add sample to projitems

Co-authored-by: Mike Herman <c-michael.herman@charter.com>
Co-authored-by: rachelkang <rachelkang@microsoft.com>
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
  • Loading branch information
4 people committed Jan 14, 2022
1 parent 97d4f1c commit 576d9c6
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
@@ -0,0 +1,58 @@
using System.Collections.Generic;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
#endif

namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.ManualReview)]
[Category(UITestCategories.Accessibility)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 13193,
"Double prompt when voice over reads picker item on iOS",
PlatformAffected.iOS)]
public class Issue13193 : TestContentPage
{
public Issue13193()
{
}

protected override void Init()
{
Title = "Issue 13193";

var layout = new StackLayout
{
Padding = 12
};

var instructions = new Label
{
Text = "Turn VoiceOver on, select the picker, double-tap to edit, select the input view, and swipe up to navigate through the picker items. If an item or a truncated portion of an item is read twice, the test failed"
};

var picker = new Picker
{
ItemsSource = new List<string>
{
"Bananas",
"New York",
"Grapes"
}
};

layout.Children.Add(instructions);
layout.Children.Add(picker);

Content = layout;

}
}
}
Expand Up @@ -1814,6 +1814,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Issue13616.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue13670.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue13684.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue13193.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue14066.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue8129.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue12300.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs
Expand Up @@ -179,6 +179,7 @@ void OnStarted(object sender, EventArgs eventArgs)

void RowsCollectionChanged(object sender, EventArgs e)
{
_picker.ReloadAllComponents();
UpdatePicker();
}

Expand Down Expand Up @@ -241,7 +242,6 @@ void UpdatePicker()
var oldText = Control.Text;
Control.Text = selectedIndex == -1 || items == null || selectedIndex >= items.Count ? "" : items[selectedIndex];
UpdatePickerNativeSize(oldText);
_picker.ReloadAllComponents();
if (items == null || items.Count == 0)
return;

Expand Down

0 comments on commit 576d9c6

Please sign in to comment.