-
Notifications
You must be signed in to change notification settings - Fork 834
fix(wasm): Add Control key code mappings for keyboard events #22104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
1 similar comment
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug on WebAssembly where pressing the Control key incorrectly returns VirtualKey.None instead of VirtualKey.Control in KeyDown events. The issue was caused by missing mappings for browser's "ControlLeft" and "ControlRight" key codes in the BrowserVirtualKeyHelper.FromCode() method.
Key Changes:
- Added Control key mappings ("ControlLeft" and "ControlRight") to
BrowserVirtualKeyHelper.FromCode() - Added comprehensive runtime tests validating Control, Shift, Alt, and Ctrl+A key detection on WASM/Skia platforms
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Uno.UWP/System/BrowserVirtualKeyHelper.cs | Added "ControlLeft" and "ControlRight" case mappings to return VirtualKey.Control, matching existing Shift/Alt patterns |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Input/Given_KeyRoutedEventArgs.cs | New test class with 4 runtime tests for Control, Shift, Alt key presses and Ctrl+A combination |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-22104/docs/index.html |
|
D:\a\1\s\src\Uno.UI.RuntimeTests\Tests\Windows_UI_Xaml_Input\Given_KeyRoutedEventArgs.cs(30,9): error CS0103: The name 'UITestHelper' does not exist in the current context [D:\a\1\s\src\Uno.UI.RuntimeTests\Uno.UI.RuntimeTests.Skia.csproj::TargetFramework=net9.0] |
Fixed all build errors in commit a113841:
|
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-22104/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22104/wasm-skia-net9/index.html |
a113841 to
b04e8cc
Compare
…lKeyHelper Co-authored-by: MartinZikmund <[email protected]>
b04e8cc to
f276f86
Compare
|
@copilot can you create a test that validates the return value for Ctrl key on |
Co-authored-by: MartinZikmund <[email protected]>
Created WASM-specific runtime test in commit 252ecc6. The test validates
All tests are wrapped in |
Co-authored-by: MartinZikmund <[email protected]>
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22104/wasm-skia-net9/index.html |
src/Uno.UI.RuntimeTests/Tests/Windows_System/Given_BrowserVirtualKeyHelper.cs
Outdated
Show resolved
Hide resolved
…r WASM tests Co-authored-by: MartinZikmund <[email protected]>
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-22104/docs/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-22104/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22104/wasm-skia-net9/index.html |
src/Uno.UI.RuntimeTests/Tests/Windows_System/Given_BrowserVirtualKeyHelper.cs
Show resolved
Hide resolved
Co-authored-by: MartinZikmund <[email protected]>
Head branch was pushed to by a user without write access
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22104/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-22104/docs/index.html |
|
|
Original prompt
Controlkey is not recognized for key events #22103💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.