Keyboard focus sometimes remain at not active docking window

Docking/MDI for WPF Forum

Posted 19 days ago by Yuki
Version: 22.1.1
Platform: .NET 6.0
Environment: Windows 10 (64-bit)


I'm using WebView2 in document window.

Keyboard focus sometimes remain at not active docking window. (Input cursor is blinking)

Would you please check it?

You can see the problem in "Primary Document Tracking" sample with the following step.

  • Change "Document2.txt" and "Document3.txt" content to WebView2 (Please refer to this thread)
  • Show "Document2.txt" and click Search TextBox. (Move input cursor)
  • Float "Document3.txt" and click Search TextBox. (Move input cursor)
  • Switch active window between "Document2.txt" and "Document3.txt".
    • After several switching, input cursor is displayed on both window.

Comments (4)

Posted 18 days ago by Actipro Software Support - Cleveland, OH, USA


It seems like this might be related to this other forum thread.  In that thread, we had to add a try..catch around some focus request code that works in all other interop controls, but not WebView2 for some reason. 

When debugging this now, we are not seeing the original ArgumentException show up any more (no exception is raised by them now). However we do see this particular focus-related issue you reported sometimes show up.  We added some code to try and identify when the HwndHost is a WebView2 and if so, it will skip over a couple focus attempts that used to cause that ArgumentException.  After that was added, we aren't seeing the focus issue any more in our test sample.

Can you write our support address and request a preview build to test with this new code update, so you can try it in your more complex app and make sure the problem was resolved?

Actipro Software Support

Posted 17 days ago by Yuki


I have recieved 22.1.2-beta.10 and checked if the problem is solved or not.

--> The problem still occur.

I created simple web page for WebView2.Source.

Would you please check with it?

<wv2:WebView2 docking:InteropFocusTracking.IsEnabled="True" Source="C:/XXXXX/Index.html" />


<!DOCTYPE html>
<html lang="ja">
<meta charset="utf-8">
<title>TextBox Sample</title>
<form action="#" method="post">
	<input type="text" name="name">
Posted 16 days ago by Actipro Software Support - Cleveland, OH, USA


Thanks for the simple HTML example.  We were able to reproduce it easier with that and reverted some of the changes from beta 10 to try something else.  It seems like calling the WebView2.Focus() method is what triggers the problem scenario, which should not be an issue in general and seems buggy on Microsoft's end.  However we will avoid that call from our Docking/MDI focus logic for WebView2 and will focus it another way.

We have created beta 11 and will e-mail you a link to it to test with.

Actipro Software Support

Posted 15 days ago by Yuki


Thank you for your support.

I checked the problem no longer occur at beta 11.

The latest build of this product (v22.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.