Skip to content

fix: VirtualKeyHelper OEM mappings - #23233

Merged
MartinZikmund merged 3 commits into
masterfrom
dev/doti/virtual-key-mappings
May 9, 2026
Merged

MartinZikmund merged 3 commits into
masterfrom
dev/doti/virtual-key-mappings

Conversation

@morning4coffe-dev

Copy link
Copy Markdown
Member

GitHub Issue: closes https://github.com/unoplatform/kahua-private/issues/472

PR Type:

🐞 Bugfix

What changed? 🚀

PR Checklist ✅

Copilot AI review requested due to automatic review settings May 8, 2026 20:46
@github-actions github-actions Bot added platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia platform/x11 🐧 Categorizes an issue or PR as relevant to X11 labels May 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 cross-platform mappings for OEM (punctuation-row) keys so they map to the correct Win32 VK_OEM_* virtual key codes instead of keypad-specific keys (e.g., Decimal, Subtract) or None. It also adds WASM Skia runtime tests to prevent regressions in the browser keyboard ingress and BrowserVirtualKeyHelper.FromCode.

Changes:

  • Update iOS (UIKit) and Android keycode mappings to return VirtualKeyHelper.Oem* values for OEM-row keys.
  • Extend browser (event.code) mapping to cover OEM-row physical keys (shift-independent) and add regression tests.
  • Enable OEM-row mappings on Linux FrameBuffer and Skia X11 paths using VirtualKeyHelper.Oem*.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Uno.UWP/System/VirtualKeyHelper.UIKit.cs Remaps UIKit HID usages for punctuation/OEM keys to VirtualKeyHelper.Oem* constants.
src/Uno.UWP/System/VirtualKeyHelper.Android.cs Remaps Android Keycode OEM-row keys to VirtualKeyHelper.Oem* constants.
src/Uno.UWP/System/BrowserVirtualKeyHelper.cs Adds event.code OEM-row mappings to Win32 VK_OEM_* values; clarifies unmapped fall-through behavior.
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Input/Given_BrowserKeyboardInputSource.cs Adds SkiaWasm runtime test covering end-to-end OnNativeKeyboardEvent -> KeyDown virtual key mapping and modifier propagation.
src/Uno.UI.RuntimeTests/Tests/Windows_System/Given_BrowserVirtualKeyHelper.cs Adds runtime test coverage for BrowserVirtualKeyHelper.FromCode OEM-row mappings.
src/Uno.UI.Runtime.Skia.X11/X11_Bindings/x11bindings_X11KeyTransform.cs Enables X11 OEM-row mappings using VirtualKeyHelper.Oem*.
src/Uno.UI.Runtime.Skia.Linux.FrameBuffer/Devices/Input/FrameBufferKeyboardInputSource.cs Maps Linux input OEM-row keys to VirtualKeyHelper.Oem* (and VK_OEM_102).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 211725 found UI Test snapshots differences: skia-linux-screenshots: 54, skia-windows-screenshots: 404, wasm: 16

Details
  • skia-linux-screenshots: 54 changed over 2344

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • DisplayInformation.png-dark
    • ImageSourceUrlMsAppDataScheme.png-dark
    • ImageSourceUrlMsAppDataScheme.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • Examples.png-dark
    • Examples.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
  • skia-windows-screenshots: 404 changed over 2344

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AuthenticationBroker_Demo.png
    • AutoSuggestBox_SoftKeboard.png-dark
    • BorderVersusPanelClipping.png-dark
    • BorderVersusPanelClipping.png
    • ElevatedView_Dimensions.png-dark
    • ElevatedView_Dimensions.png
    • ElevatedView_Levels.png-dark
    • ElevatedView_Levels.png
    • ApplicationViewMode.png
    • AutomationPropertiesExtensions_Role.png-dark
    • ClippingWithOpacity.png-dark
    • ClippingWithOpacity.png
    • Display.DisplayRequest.png-dark
    • Display.DisplayRequest.png
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • ElevatedViewTests.png-dark
    • ElevatedViewTests.png
    • ElevatedView_BorderThickness.png-dark
    • ElevatedView_BorderThickness.png
  • wasm: 16 changed over 1075

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • MUXControlsTestApp.NavigationViewTopNavPage
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Shared.Windows_UI_Input.GestureRecognizer.PointersEvents
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewLarge
    • UITests.Windows_UI_Xaml.Performance.Performance_1000ButtonsContinuousRendering
    • UITests.Windows_UI_Xaml_Shapes.Offscreen_Shapes
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Shared.Windows_UI_Xaml_Controls.ImageTests.Image_Stretch_Algmnt_Inf_Horizontal
    • UITests.Shared.Windows_UI_Xaml_Controls.ImageTests.Image_Stretch_Algmnt_Inf_Vertical
    • Uno.UI.Samples.Content.UITests.TextBoxControl.TextBox_DeleteButton
    • Uno.UI.Samples.Samples.Shared.Content.UITests.ImageBrushInList
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • Uno.UI.Samples.UITests.ImageBrushTestControl.DoubleImageBrushInList

@MartinZikmund

Copy link
Copy Markdown
Member

Shouldn't similar mapping also be done on Win32?

@morning4coffe-dev

Copy link
Copy Markdown
Member Author

@MartinZikmund Win32 already emits the proper VK_OEM_* virtual key codes for these keys which we cast directly, I think we shouldn't need additional remapping there like we do on Wasm/iOS/Android/X11 paths where the platform key abstractions differ.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 211764 found UI Test snapshots differences: skia-linux-screenshots: 55, skia-windows-screenshots: 83, wasm: 21

Details
  • skia-linux-screenshots: 55 changed over 2344

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ImageBrush_Stretch.png-dark
    • ImageBrush_Stretch.png
    • ImageIconPage.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DisplayInformation.png-dark
    • Buttons.png-dark
    • Buttons.png
    • ImageSourceUrlMsAppDataScheme.png-dark
    • ImageSourceUrlMsAppDataScheme.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
  • skia-windows-screenshots: 83 changed over 2344

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • Examples.png-dark
    • Examples.png
    • HierarchicalNavigationViewMarkup.png-dark
    • HierarchicalNavigationViewMarkup.png
    • CalendarView_Theming.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • Buttons.png-dark
    • FluentStyle_NavigationViewSample.png-dark
    • FluentStyle_NavigationViewSample.png
    • DisplayInformation.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Image_Stretch_Alignment_Bigger.png-dark
  • wasm: 21 changed over 1075

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Microsoft_UI_Xaml_Controls.ColorPickerTests.ColorPickerSample
    • UITests.Shared.Windows_UI_Input.GestureRecognizer.PointersEvents
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • MUXControlsTestApp.NavigationViewTopNavPage
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • initial_state
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewLarge
    • UITests.Shared.Windows_UI_Xaml_Controls.ImageTests.Image_Stretch_Algmnt_Inf_Horizontal
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Shapes.Offscreen_Shapes
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • Uno.UI.Samples.Samples.Shared.Content.UITests.ImageBrushInList
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Windows_UI_Xaml.Performance.Performance_1000ButtonsContinuousRendering
    • Uno.UI.Samples.Content.UITests.TextBoxControl.TextBox_DeleteButton

@MartinZikmund
MartinZikmund merged commit b3617f7 into master May 9, 2026
71 checks passed
@MartinZikmund
MartinZikmund deleted the dev/doti/virtual-key-mappings branch May 9, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform platform/x11 🐧 Categorizes an issue or PR as relevant to X11

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants