Skip to content

Commit

Permalink
Remove LosingFocus from PipsPager (#6026)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund authored Oct 7, 2021
1 parent fb0e591 commit 6a79363
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
23 changes: 2 additions & 21 deletions dev/PipsPager/PipsPager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,22 +562,6 @@ void PipsPager::OnGotFocus(const winrt::RoutedEventArgs& args)
}
}

// In order to avoid switching visibility of the navigation buttons while moving focus inside the Pager,
// we'll check if the next focused element is inside the Pager.
void PipsPager::LosingFocus(const IInspectable& sender, const winrt::LosingFocusEventArgs& args)
{
if (const auto repeater = m_pipsPagerRepeater.get())
{
if (const auto nextFocusElement = args.NewFocusedElement().try_as<winrt::UIElement>())
{
m_ifNextFocusElementInside = repeater.GetElementIndex(nextFocusElement) != -1
|| nextFocusElement == m_previousPageButton.get()
|| nextFocusElement == m_nextPageButton.get();

}
}
}

void PipsPager::OnPipsAreaGettingFocus(const IInspectable& sender, const winrt::GettingFocusEventArgs& args)
{
if (const auto repeater = m_pipsPagerRepeater.get())
Expand Down Expand Up @@ -615,11 +599,8 @@ void PipsPager::OnPipsAreaGettingFocus(const IInspectable& sender, const winrt::

void PipsPager::OnLostFocus(const winrt::RoutedEventArgs& args)
{
if (!m_ifNextFocusElementInside)
{
m_isFocused = false;
UpdateNavigationButtonVisualStates();
}
m_isFocused = false;
UpdateNavigationButtonVisualStates();
}

void PipsPager::OnPointerEntered(const winrt::PointerRoutedEventArgs& args)
Expand Down
1 change: 0 additions & 1 deletion dev/PipsPager/PipsPager.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,4 @@ class PipsPager :
int m_lastSelectedPageIndex{ -1 };
bool m_isPointerOver{ false };
bool m_isFocused{ false };
bool m_ifNextFocusElementInside{ false };
};

0 comments on commit 6a79363

Please sign in to comment.