Skip to content

Commit

Permalink
Merge pull request #30602 from Expensify/rodrigo-fix-shortcut-bindings
Browse files Browse the repository at this point in the history
Rodrigo fix shortcut bindings
  • Loading branch information
Joel Bettner authored Oct 30, 2023
2 parents 50a327c + 186033b commit a26b8df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ const bindHandlerToKeydownEvent: BindHandlerToKeydownEvent = (getDisplayName, ev
const eventModifiers = getKeyEventModifiers(keyCommandEvent);
const displayName = getDisplayName(keyCommandEvent.input, eventModifiers);

// If we didn't register any event handlers for a key we ignore it
if (!eventHandlers[displayName]) {
return;
}

// Loop over all the callbacks
Object.values(eventHandlers[displayName]).every((callback) => {
// Determine if the event should bubble before executing the callback (which may have side-effects)
Expand Down
5 changes: 5 additions & 0 deletions src/libs/KeyboardShortcut/bindHandlerToKeydownEvent/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ const bindHandlerToKeydownEvent: BindHandlerToKeydownEvent = (getDisplayName, ev
const eventModifiers = getKeyEventModifiers(keyCommandEvent);
const displayName = getDisplayName(keyCommandEvent.input, eventModifiers);

// If we didn't register any event handlers for a key we ignore it
if (!eventHandlers[displayName]) {
return;
}

// Loop over all the callbacks
Object.values(eventHandlers[displayName]).every((callback) => {
const textArea = event.target as HTMLTextAreaElement;
Expand Down

0 comments on commit a26b8df

Please sign in to comment.