Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle keyboard shortcuts with Ctrl key #1690

Merged
merged 5 commits into from
Nov 9, 2023
Merged

Conversation

abeatrix
Copy link
Contributor

@abeatrix abeatrix commented Nov 8, 2023

fix: prevent default and stop propagation on certain key combos

Prevent default behavior on ctrl + non-allowlisted keys..
Also check for alt + vscode cody shortcuts and prevent default without stopping propagation.

This fixes issues with certain key combinations triggering unintended characters in input box.

  • Add ctrlKeysAllowList Set to check pressed keys.
  • Check ctrlKey or AltGraph modifier and that key is not in allow list.
  • If so, prevent default browser shortcut and stop event propagation.

Test plan

Pressing CtrlKey with any of the keys in the allowed list should not add character to the chat inbox.

Before

Press alt+/ when chat box is focused. This shortcut will open a new Cody panel, but it will also add a symbol to your chat input box:

image

After

Press alt+/ when chat box is focused will not change your current input in the input box.

@abeatrix abeatrix requested a review from a team November 8, 2023 21:15
Copy link
Contributor

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@abeatrix abeatrix added the chat/commands Chat and Commands label Nov 9, 2023
@abeatrix abeatrix merged commit ac62708 into main Nov 9, 2023
14 checks passed
@abeatrix abeatrix deleted the bee/input-allow-list branch November 9, 2023 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chat/commands Chat and Commands
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants