Skip to content

Commit

Permalink
Don't trigger keyboard shortcuts when typing
Browse files Browse the repository at this point in the history
Adds a check to 'onKeyDown' event handler that checks if the user is
focused on an input or textinput field.  If true, does not proceed with
executing keyboard shortcuts.

Signed-off-by: William Yang <[email protected]>
  • Loading branch information
williamsyang-work authored and hriday-panchasara committed Jul 11, 2024
1 parent 2f5bb1d commit 79b60ef
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,14 @@ export class TraceContextComponent extends React.Component<TraceContextProps, Tr
}

private onKeyDown(event: React.KeyboardEvent) {
if (
document.activeElement &&
(document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA')
) {
// User is typing in an input field, ignore the shortcut
return;
}

switch (event.key) {
case '+':
case '=': {
Expand Down

0 comments on commit 79b60ef

Please sign in to comment.