CommunityToolkit / Microsoft.Toolkit.Win32

ARCHIVE - This repository contained XAML Islands wrapper controls and tooling for XAML Islands with WinUI 2, see readme for more info about XAML Islands with WinUI 3 and the WindowsAppSDK.
https://aka.ms/windowsappsdk
Other
384 stars 89 forks source link

WebView AcceleratorKeyPressed event didn't work, if pressed shift key #201

Open Jong-uk-Kim opened 5 years ago

Jong-uk-Kim commented 5 years ago

Describe the bug

didn't fire keyboard event from WebView when I press shift key.

XAML code

<Window x:Class="WebView_KeyAccelerator_test.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:control="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls.WebView" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800">

<Grid>
    <control:WebView Source="https://google.com"
                     AcceleratorKeyPressed="WebView_AcceleratorKeyPressed"></control:WebView>
</Grid>

Behind code

private void WebView_AcceleratorKeyPressed(object sender, Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlAcceleratorKeyPressedEventArgs e) { Debug.WriteLine($"{e.EventType} / {e.VirtualKey}({(int)e.VirtualKey}) / {e.Handled}"); }

Steps to Reproduce

Steps to reproduce the behavior:

  1. attach accelerator key event,
  2. press shift key

Expected behavior

receive AcceleratorKeyPressed event.

Screenshots

image

Environment

NuGet Package(s): 

Package Version(s): 

Project .NET Version:
- [x] .NET Framework (version: 4.6.2)
- [ ] .NET Core 3
- [ ] .NET Core 3.1 Preview (version: )

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [x] Insider Build (build number: 19008)

App min and target version:
- [ ] Fall Creators Update (16299)
- [x] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (xxxxx)

Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [x] 2019 (version: 16.2.2) 
- [ ] 2019 Preview (version: )

Additional context

it is right behavior? if right please explain to me.

michael-hawker commented 5 years ago

Thanks @Jong-uk-Kim, but I believe this is already a known limitation: https://docs.microsoft.com/en-us/windows/communitytoolkit/controls/wpf-winforms/webview-known-issues#user-interaction

It'd be best to test this scenario with WebView2 and give them feedback here.