fix(client): completion modal cannot be closed using Escape key (#55431)

This commit is contained in:
Gagan Bhullar
2024-07-16 02:51:17 -06:00
committed by GitHub
parent c7ac59faa4
commit 806706bdee
2 changed files with 45 additions and 0 deletions

View File

@@ -128,6 +128,10 @@ class CompletionModal extends Component<
}
handleKeypress(e: React.KeyboardEvent): void {
if (e.key === 'Escape') {
e.stopPropagation();
this.props.close();
}
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
e.preventDefault();
// Since Hotkeys also listens to Ctrl + Enter we have to stop this event