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

Commit 576d9c6

Browse files
MichaelLHermanMike Hermanrachelkangjfversluis
authored
[iOS] Picker - Fix VoiceOver reading reading row twice (#14209)
* only reload picker on collection change * Add sample to projitems Co-authored-by: Mike Herman <[email protected]> Co-authored-by: rachelkang <[email protected]> Co-authored-by: Gerald Versluis <[email protected]>
1 parent 97d4f1c commit 576d9c6

File tree

3 files changed

+60
-1
lines changed

3 files changed

+60
-1
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using System.Collections.Generic;
2+
using Xamarin.Forms.CustomAttributes;
3+
using Xamarin.Forms.Internals;
4+
5+
#if UITEST
6+
using Xamarin.UITest;
7+
using NUnit.Framework;
8+
using Xamarin.Forms.Core.UITests;
9+
#endif
10+
11+
namespace Xamarin.Forms.Controls.Issues
12+
{
13+
#if UITEST
14+
[Category(UITestCategories.ManualReview)]
15+
[Category(UITestCategories.Accessibility)]
16+
#endif
17+
[Preserve(AllMembers = true)]
18+
[Issue(IssueTracker.Github, 13193,
19+
"Double prompt when voice over reads picker item on iOS",
20+
PlatformAffected.iOS)]
21+
public class Issue13193 : TestContentPage
22+
{
23+
public Issue13193()
24+
{
25+
}
26+
27+
protected override void Init()
28+
{
29+
Title = "Issue 13193";
30+
31+
var layout = new StackLayout
32+
{
33+
Padding = 12
34+
};
35+
36+
var instructions = new Label
37+
{
38+
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"
39+
};
40+
41+
var picker = new Picker
42+
{
43+
ItemsSource = new List<string>
44+
{
45+
"Bananas",
46+
"New York",
47+
"Grapes"
48+
}
49+
};
50+
51+
layout.Children.Add(instructions);
52+
layout.Children.Add(picker);
53+
54+
Content = layout;
55+
56+
}
57+
}
58+
}

Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,6 +1814,7 @@
18141814
<Compile Include="$(MSBuildThisFileDirectory)Issue13616.xaml.cs" />
18151815
<Compile Include="$(MSBuildThisFileDirectory)Issue13670.xaml.cs" />
18161816
<Compile Include="$(MSBuildThisFileDirectory)Issue13684.xaml.cs" />
1817+
<Compile Include="$(MSBuildThisFileDirectory)Issue13193.cs" />
18171818
<Compile Include="$(MSBuildThisFileDirectory)Issue14066.xaml.cs" />
18181819
<Compile Include="$(MSBuildThisFileDirectory)Issue8129.cs" />
18191820
<Compile Include="$(MSBuildThisFileDirectory)Issue12300.cs" />

Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ void OnStarted(object sender, EventArgs eventArgs)
179179

180180
void RowsCollectionChanged(object sender, EventArgs e)
181181
{
182+
_picker.ReloadAllComponents();
182183
UpdatePicker();
183184
}
184185

@@ -241,7 +242,6 @@ void UpdatePicker()
241242
var oldText = Control.Text;
242243
Control.Text = selectedIndex == -1 || items == null || selectedIndex >= items.Count ? "" : items[selectedIndex];
243244
UpdatePickerNativeSize(oldText);
244-
_picker.ReloadAllComponents();
245245
if (items == null || items.Count == 0)
246246
return;
247247

0 commit comments

Comments
 (0)