Skip to content

Commit

Permalink
allow Enter to open dropdown menu
Browse files Browse the repository at this point in the history
  • Loading branch information
dlqqq committed Jul 29, 2024
1 parent b983640 commit 3433e62
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/jupyter-ai/src/components/chat-input/send-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,22 @@ export function SendButton(props: SendButtonProps): JSX.Element {
<SendIcon />
</TooltippedButton>
<TooltippedButton
onClick={e => openMenu(e.currentTarget)}
onClick={e => {
openMenu(e.currentTarget);
}}
disabled={disabled}
tooltip=""
buttonProps={{
variant: 'contained'
variant: 'contained',
onKeyDown: e => {
if (e.key !== 'Enter' && e.key !== ' ') {
return;
}
openMenu(e.currentTarget);
// stopping propagation of this event prevents the prompt from being
// sent when the dropdown button is selected and clicked via 'Enter'.
e.stopPropagation();
}
}}
sx={{
minWidth: 'unset',
Expand Down

0 comments on commit 3433e62

Please sign in to comment.