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

Commit 36b39e4

Browse files
committed
Merge branch 'accessibility-views-effects' of https://github.com/xamarin/XamarinCommunityToolkit into accessibility-views-effects
2 parents 626e09b + 727873e commit 36b39e4

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

samples/XCT.Sample/Pages/Views/SemanticOrderViewPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<Button x:Name="third" Text="Third" Margin="0,20" />
1414
<Label x:Name="fourth" Text="Fourth" Margin="0,20" />
1515
<Button x:Name="fifth" Text="Fifth and last" Margin="0,20" />
16-
<Label x:Name="first" Text="First" Margin="0,20" />
16+
<Button x:Name="first" Text="First" Margin="0,20" />
1717
</StackLayout>
1818
</xct:SemanticOrderView>
1919
</StackLayout>

src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/Semantic/SemanticEffectRouter.uwp.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
using Windows.UI.Xaml.Automation;
77
using Windows.UI.Xaml.Automation.Peers;
88
using Xamarin.CommunityToolkit.Effects;
9+
using Effects = Xamarin.CommunityToolkit.UWP.Effects;
10+
11+
[assembly: Xamarin.Forms.ExportEffect(typeof(Effects.SemanticEffectRouter), nameof(SemanticEffectRouter))]
912

1013
namespace Xamarin.CommunityToolkit.UWP.Effects
1114
{
@@ -22,15 +25,18 @@ protected override void Update(FrameworkElement view, SemanticEffectRouter effec
2225
{
2326
var headingLevel = (AutomationHeadingLevel)((int)SemanticEffect.GetHeadingLevel(Element));
2427
AutomationProperties.SetHeadingLevel(view, headingLevel);
25-
AutomationProperties.SetName(view, SemanticEffect.GetDescription(Element));
26-
AutomationProperties.SetHelpText(view, SemanticEffect.GetHint(Element));
28+
29+
AutomationProperties.SetName(view, SemanticEffect.GetDescription(Element) ?? string.Empty);
30+
AutomationProperties.SetHelpText(view, SemanticEffect.GetHint(Element) ?? string.Empty);
2731
}
2832

2933
protected override void OnElementPropertyChanged(PropertyChangedEventArgs args)
3034
{
3135
base.OnElementPropertyChanged(args);
3236

33-
if (args.PropertyName == SemanticEffect.HeadingLevelProperty.PropertyName)
37+
if (args.PropertyName == SemanticEffect.HeadingLevelProperty.PropertyName ||
38+
args.PropertyName == SemanticEffect.DescriptionProperty.PropertyName ||
39+
args.PropertyName == SemanticEffect.HintProperty.PropertyName)
3440
{
3541
Update();
3642
}

0 commit comments

Comments
 (0)