Skip to content

Commit

Permalink
Fix issue with invoke pattern being provided for top navview item (mi…
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara committed Jul 26, 2020
1 parent bad9003 commit 8e0b6ed
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ModernWpf.Controls/NavigationView/NavigationViewItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void UpdateCompactPaneLength()
}
}

void UpdateIsClosedCompact()
internal void UpdateIsClosedCompact()
{
if (GetSplitView() is { } splitView)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System.Collections;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
Expand Down Expand Up @@ -48,7 +47,6 @@ protected override string GetNameCore()
public override object GetPattern(PatternInterface pattern)
{
if (pattern == PatternInterface.SelectionItem ||
pattern == PatternInterface.Invoke ||
// Only provide expand collapse pattern if we have children!
(pattern == PatternInterface.ExpandCollapse && HasChildren()))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public override void OnApplyTemplate()
InputHelper.AddTappedHandler(expandCollapseChevron, navigationViewItem.OnExpandCollapseChevronTapped);
}
navigationViewItem.UpdateVisualStateNoTransition();

navigationViewItem.UpdateIsClosedCompact();

// We probably switched displaymode, so restore width now, otherwise the next time we will restore is when the CompactPaneLength changes
if (navigationViewItem.GetNavigationView() is { } navigationView)
Expand Down
4 changes: 3 additions & 1 deletion test/ModernWpfTestApp/ApiTests/NavigationViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,15 @@ public void VerifyNavigationItemUIAType()
Verify.AreEqual(
AutomationControlType.ListItem,
NavigationViewItemAutomationPeer.CreatePeerForElement(menuItem1).GetAutomationControlType());
Verify.IsNull(NavigationViewItemAutomationPeer.CreatePeerForElement(menuItem1).GetPattern(PatternInterface.Invoke));
navView.PaneDisplayMode = NavigationViewPaneDisplayMode.Top;
Content.UpdateLayout();
Verify.AreEqual(
AutomationControlType.TabItem,
NavigationViewItemAutomationPeer.CreatePeerForElement(menuItem1).GetAutomationControlType());
// Tabs should only provide SelectionItem pattern but not Invoke pattern
Verify.IsNull(NavigationViewItemAutomationPeer.CreatePeerForElement(menuItem1).GetPattern(PatternInterface.Invoke));
});
}

Expand Down

0 comments on commit 8e0b6ed

Please sign in to comment.