зеркало из https://github.com/DeGsoft/maui-linux.git
iOS - Test and fix for VoiceOver crash on a ContentPage not having any Content defined (#6987) fixes #6926
* Added test case for showing crash for issue 6926. * Potential fix for issue 6926. Prevents a null reference exception when a ContentPage has no Content.
This commit is contained in:
Родитель
beab7a98bd
Коммит
a237197208
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Github, 6926, "[iOS] iOS - Using VoiceOver will crash when a ContentPage has no Content", PlatformAffected.iOS)]
|
||||
public class GitHub6926 : TestContentPage
|
||||
{
|
||||
protected override void Init()
|
||||
{
|
||||
Content = new StackLayout
|
||||
{
|
||||
Children = {
|
||||
new Label()
|
||||
{
|
||||
Text = "Enable VoiceOver and then click either:",
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
VerticalTextAlignment = TextAlignment.Center,
|
||||
},
|
||||
new Button()
|
||||
{
|
||||
Text = "ContentPage without content (crash)",
|
||||
Command = new Command(() =>
|
||||
{
|
||||
Navigation.PushAsync(new ContentPage());
|
||||
})
|
||||
},
|
||||
new Button()
|
||||
{
|
||||
Text = "ContentPage with content (no crash)",
|
||||
Command = new Command(() =>
|
||||
{
|
||||
Navigation.PushAsync(new ContentPage() { Content = new StackLayout() });
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -979,6 +979,7 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)Issue3548.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue6472.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue6614.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)GitHub6926.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla22229.xaml">
|
||||
|
|
|
@ -62,6 +62,9 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
[Export("accessibilityElementCount")]
|
||||
nint AccessibilityElementCount()
|
||||
{
|
||||
if (AccessibilityElements == null)
|
||||
return 0;
|
||||
|
||||
// Note: this will only be called when VoiceOver is enabled
|
||||
return AccessibilityElements.Count;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче