Backwards tab navigation cannot move focus away from a Windows Forms BlazorWebView
Description
When using backwards tab navigation (shift+tab) on the children of a BlazorWebView, focus cannot escape the WebView. When the first child of the WebView is focused, shift+tabbing results in the last child of the WebView receiving focus rather than the native control whose tab index precedes that of the BlazorWebView.
This does not reproduce on the Windows Forms WebView2 control, so it does appear to be specific to Blazor Hybrid.
Steps to Reproduce
- Create a File > New Windows Forms App
- Follow the steps here to turn the project into a Windows Forms Blazor app
- Add two
Buttoncontrols toForm1, where the tab order goes "button1>blazorWebView1>button2" - Run the app
- Click on
button1so it receives focus. - Press "tab"
- The focus should now be on the "Click me" button in the WebView
- Press "shift+tab", and note that the focus still remains on the "Click me" button
- Press "tab" and note that the focus escapes the WebView to
button2
Version with bug
6.0.400 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Tested on Windows 11 Enterprise, Version 21H2
Did you find any workaround?
I did not find a workaround.
Relevant log output
No response
@MackinnonBuck can you share the repro project please?
Hi @MackinnonBuck. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
I've added a repro project here: https://github.com/MackinnonBuck/BlazorWebViewWinFormsTabNavigationBug
confirm same as above description. when the click me button is focused, shift+tab results in Dummy2 focus, not button1.
https://user-images.githubusercontent.com/99457000/176342990-a122d6b0-7a7a-4122-a892-827f72db219a.mp4
I was able to reproduce this issue when wrapping a WebView2 control in an otherwise empty ContainerControl and reproduce the same issue, so I've opened https://github.com/MicrosoftEdge/WebView2Feedback/issues/2835 to track this getting resolved.
Closing since this is a bug with the WebView2 Windows Forms control and we have a separate issue tracking that.