Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove LosingFocus from PipsPager #6026

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 };
};