@progress/kendo-angular-common
Version:
Kendo UI for Angular - Utility Package
24 lines (23 loc) • 1.21 kB
TypeScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
/**
* @hidden
*
* Normalizes keyboard events to ensure consistent key handling across different keyboard layouts.
*
* This function addresses the following scenarios:
* 1. On some keyboards, PageUp/Down, Home/End, and arrow keys are mapped to Numpad keys
* 2. For letter keys (KeyA-KeyZ), checks the deprecated keyCode property to handle non-QWERTY layouts
* (e.g., AZERTY, QWERTZ) where event.code may not match the expected letter
*
* @param event - The keyboard event to normalize
* @returns The normalized key code string (e.g., 'KeyA', 'ArrowDown', 'Enter')
*
* @example
* // On an AZERTY layout, pressing Ctrl+A (where 'A' is physically at 'Q' position)
* // event.code = 'KeyQ', event.keyCode = 65
* const code = normalizeKeys(event); // Returns 'KeyA'
*/
export declare const normalizeKeys: (event: KeyboardEvent) => string;