Skip to content

Commit 8b20a88

Browse files
arpitmathurmsftbot[bot]
authored andcommitted
Fixing MAS Compliance Issues (#1278)
* Ensuring GroupItemAutomationPeer adds underlying ExpanderPeer to its list of children peers * Enabling ScrollPattern only when Combobox dropDown is opened * Addressing PR feedback
1 parent 2575fb0 commit 8b20a88

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/ComboBoxAutomationPeer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,20 @@ override protected string GetClassNameCore()
5151
override public object GetPattern(PatternInterface pattern)
5252
{
5353
object iface = null;
54+
ComboBox owner = (ComboBox)Owner;
5455

5556
if (pattern == PatternInterface.Value)
5657
{
57-
ComboBox owner = (ComboBox)Owner;
5858
if (owner.IsEditable) iface = this;
5959
}
6060
else if(pattern == PatternInterface.ExpandCollapse)
6161
{
6262
iface = this;
6363
}
64+
else if (pattern == PatternInterface.Scroll && !owner.IsDropDownOpen)
65+
{
66+
iface = this;
67+
}
6468
else
6569
{
6670
iface = base.GetPattern(pattern);

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GroupItemAutomationPeer.cs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,7 @@ protected override List<AutomationPeer> GetChildrenCore()
130130
ItemsControlAutomationPeer itemsControlAP = itemsControl.CreateAutomationPeer() as ItemsControlAutomationPeer;
131131
if (itemsControlAP != null)
132132
{
133-
Panel itemsHost = owner.ItemsHost;
134-
135-
if (itemsHost == null)
136-
return null;
137-
138-
IList childItems = itemsHost.Children;
139-
List<AutomationPeer> children = new List<AutomationPeer>(childItems.Count);
140-
ItemPeersStorage<ItemAutomationPeer> addedChildren = new ItemPeersStorage<ItemAutomationPeer>();
133+
List<AutomationPeer> children = new List<AutomationPeer>();
141134
bool useNetFx472CompatibleAccessibilityFeatures = AccessibilitySwitches.UseNetFx472CompatibleAccessibilityFeatures;
142135

143136
if (!useNetFx472CompatibleAccessibilityFeatures && owner.Expander != null)
@@ -152,6 +145,24 @@ protected override List<AutomationPeer> GetChildrenCore()
152145
_expanderPeer.GetChildren();
153146
}
154147
}
148+
Panel itemsHost = owner.ItemsHost;
149+
150+
if (itemsHost == null)
151+
{
152+
if (_expanderPeer == null)
153+
{
154+
return null;
155+
}
156+
else
157+
{
158+
children.Add(_expanderPeer);
159+
return children;
160+
}
161+
}
162+
163+
IList childItems = itemsHost.Children;
164+
ItemPeersStorage<ItemAutomationPeer> addedChildren = new ItemPeersStorage<ItemAutomationPeer>();
165+
155166

156167
foreach (UIElement child in childItems)
157168
{

0 commit comments

Comments
 (0)