Skip to content

Commit 5bc705f

Browse files
Jaylyn-BarbeeArlodotexe
authored andcommitted
Fixed a11y issue #391
1 parent 11280e0 commit 5bc705f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

components/SettingsControls/src/SettingsCard/SettingsCardAutomationPeer.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace CommunityToolkit.WinUI.Controls;
77
/// <summary>
88
/// AutomationPeer for SettingsCard
99
/// </summary>
10-
public partial class SettingsCardAutomationPeer : FrameworkElementAutomationPeer
10+
public partial class SettingsCardAutomationPeer : ButtonBaseAutomationPeer
1111
{
1212
/// <summary>
1313
/// Initializes a new instance of the <see cref="SettingsCard"/> class.
@@ -66,4 +66,24 @@ protected override string GetNameCore()
6666

6767
return base.GetNameCore();
6868
}
69+
70+
/// <inheritdoc/>
71+
protected override object? GetPatternCore(PatternInterface patternInterface)
72+
{
73+
if (patternInterface == PatternInterface.Invoke)
74+
{
75+
if (Owner is SettingsCard settingsCard && settingsCard.IsClickEnabled)
76+
{
77+
// Only provide Invoke pattern if the card is clickable
78+
return this;
79+
}
80+
else
81+
{
82+
// Not clickable, do not provide Invoke pattern
83+
return null;
84+
}
85+
}
86+
87+
return base.GetPatternCore(patternInterface);
88+
}
6989
}

0 commit comments

Comments
 (0)