2
UWP WebView有点怪异与焦点。UWP WebView焦点
我有一个完全覆盖WebView的单页TestApp。
当App获得焦点时,WebView控件获取焦点(并接收GotFocus事件),但DOM document.hasFocus的状态保持为false。
当用户点击html时,document.hasFocus变为true,webView接收到LostFocus事件。
想要/预期的行为将是,如果应用程序/页面被激活,WebView的内容得到焦点。
有什么建议吗?
XAML:
<Page
x:Class="TestApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TestApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<WebView x:Name="webView" NavigationStarting="webView_NavigationStarting" GotFocus="webView_GotFocus" LostFocus="webView_LostFocus"/>
</Grid>
</Page>