MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
444 stars 53 forks source link

WPF - Tabcontrol - focus problem (activeElement) #2106

Open Yannouu opened 2 years ago

Yannouu commented 2 years ago

Hello,

I'm using multiple webviews2 inside a WPF tabcontrol, one webview per tabitem When you switch tab, the focus inside the webview is lost. The webview still have keyboardfocus but the activeElement is not the same.

SDK: 1.0.1133-prerelease Runtime: edge 97.0.1072.69 Framework: WPF OS: WIN 10

You can reproduce this in the webview2 sample, WebView2WpfBrowser project for example.

Simply replace the single webview by a tabcontrol with 2 webview :

<TabControl Name="tabControl">
                <TabItem Header="webview1">
                    <wv2:WebView2 x:Name="webView" CreationProperties="{StaticResource EvergreenWebView2CreationProperties}" Source="https://www.bing.com/"/>
                </TabItem>
                <TabItem Header="webview2">
                    <wv2:WebView2 x:Name="webView2" CreationProperties="{StaticResource EvergreenWebView2CreationProperties}" Source="https://www.bing.com/"/>
                </TabItem>
</TabControl>

Focus the bing searchbar, switch to tab2, switch back to tab1; focus is not inside the searchbar anymore.

Regards

AB#36775741

champnic commented 2 years ago

Hey @Yannouu - thanks for the bug report! This will get fixed with some rearchitecture work we are currently doing, and looks related to #1134. I'll link this to that scenario.