From 227885f1a7a3174251fde69052c27b674dcdc5c8 Mon Sep 17 00:00:00 2001 From: Dmitriy Komin Date: Tue, 17 Oct 2023 18:06:53 -0700 Subject: [PATCH] Fix compariosn of strongThis with nextElement (strongThis->try_as always gives null) --- dev/WebView2/WebView2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/WebView2/WebView2.cpp b/dev/WebView2/WebView2.cpp index d6ccbb0ed5..aa3fdf2142 100644 --- a/dev/WebView2/WebView2.cpp +++ b/dev/WebView2/WebView2.cpp @@ -597,7 +597,7 @@ void WebView2::RegisterCoreEventHandlers() return winrt::FocusManager::FindNextElement(xamlDirection); } }(); - if (nextElement && nextElement.try_as() == strongThis->try_as()) + if (nextElement && nextElement.try_as() == *(strongThis.get())) { // 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.