diff --git a/dev/WebView2/WebView2.cpp b/dev/WebView2/WebView2.cpp index aa503985a2..d6ccbb0ed5 100644 --- a/dev/WebView2/WebView2.cpp +++ b/dev/WebView2/WebView2.cpp @@ -597,11 +597,11 @@ void WebView2::RegisterCoreEventHandlers() return winrt::FocusManager::FindNextElement(xamlDirection); } }(); - if (nextElement && nextElement.try_as() == strongThis) + if (nextElement && nextElement.try_as() == strongThis->try_as()) { // If the next element is this webview, then we are the only focusable element. Move focus back into the webview, // or else we'll get stuck trying to tab out of the top or bottom of the page instead of looping around. - MoveFocusIntoCoreWebView(moveFocusRequestedReason); + strongThis->MoveFocusIntoCoreWebView(moveFocusRequestedReason); args.Handled(TRUE); } else if (nextElement) @@ -1978,4 +1978,4 @@ winrt::UISettings WebView2::GetUISettings() m_uiSettings = winrt::UISettings(); } return m_uiSettings; -} \ No newline at end of file +}