From c7e849ac9089442ca2ec3e1189d02331c7325e3a Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Wed, 4 May 2022 14:01:53 +0530 Subject: [PATCH] fix: modifier-only key observers not working (#1009) --- app/assets/javascripts/Services/IOService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/Services/IOService.ts b/app/assets/javascripts/Services/IOService.ts index 9ee0660ba..9190ef9f9 100644 --- a/app/assets/javascripts/Services/IOService.ts +++ b/app/assets/javascripts/Services/IOService.ts @@ -142,7 +142,7 @@ export class IOService { private eventMatchesKeyAndModifiers( event: KeyboardEvent, - key: KeyboardKey | string, + key: KeyboardKey | string | undefined, modifiers: KeyboardModifier[] = [], ): boolean { const eventModifiers = this.modifiersForEvent(event) @@ -186,7 +186,7 @@ export class IOService { continue } - if (observer.key && this.eventMatchesKeyAndModifiers(event, observer.key, observer.modifiers)) { + if (this.eventMatchesKeyAndModifiers(event, observer.key, observer.modifiers)) { const callback = keyEvent === KeyboardKeyEvent.Down ? observer.onKeyDown : observer.onKeyUp if (callback) { callback(event)