diff --git a/packages/happy-dom/src/event/events/IKeyboardEventInit.ts b/packages/happy-dom/src/event/events/IKeyboardEventInit.ts index d04f02a65..6144e71e6 100644 --- a/packages/happy-dom/src/event/events/IKeyboardEventInit.ts +++ b/packages/happy-dom/src/event/events/IKeyboardEventInit.ts @@ -10,4 +10,9 @@ export default interface IKeyboardEventInit extends IUIEventInit { metaKey?: boolean; repeat?: boolean; isComposing?: boolean; + + /** + * @deprecated + */ + keyCode?: number; } diff --git a/packages/happy-dom/src/event/events/KeyboardEvent.ts b/packages/happy-dom/src/event/events/KeyboardEvent.ts index 632c60f1a..86327e25a 100644 --- a/packages/happy-dom/src/event/events/KeyboardEvent.ts +++ b/packages/happy-dom/src/event/events/KeyboardEvent.ts @@ -19,6 +19,11 @@ export default class KeyboardEvent extends UIEvent { public readonly repeat: boolean; public readonly shiftKey: boolean; + /** + * @deprecated + */ + public readonly keyCode: number; + /** * Constructor. * @@ -37,5 +42,6 @@ export default class KeyboardEvent extends UIEvent { this.metaKey = eventInit?.metaKey ?? false; this.repeat = eventInit?.repeat ?? false; this.shiftKey = eventInit?.shiftKey ?? false; + this.keyCode = eventInit?.keyCode ?? 0; } }