Skip to content

Commit 11dc5ce

Browse files
committed
Make Esc a Send shortcut to cancel requests
1 parent 9ff6ee8 commit 11dc5ce

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/components/send/send-page.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,21 @@ const TabContentContainer = styled.div`
2727
`;
2828

2929
const SendPageKeyboardShortcuts = (props: {
30-
onMoveSelection: (distance: number) => void
30+
onMoveSelection: (distance: number) => void,
31+
onAbortRequest?: () => void
3132
}) => {
32-
useHotkeys('Ctrl+Tab, Cmd+Tab', (event) => {
33+
useHotkeys('Ctrl+Tab, Cmd+Tab', () => {
3334
props.onMoveSelection(1);
3435
}, [props.onMoveSelection]);
3536

36-
useHotkeys('Ctrl+Shift+Tab, Cmd+Shift+Tab', (event) => {
37+
useHotkeys('Ctrl+Shift+Tab, Cmd+Shift+Tab', () => {
3738
props.onMoveSelection(-1);
3839
}, [props.onMoveSelection]);
3940

41+
useHotkeys('Escape', () => {
42+
if (props.onAbortRequest) props.onAbortRequest();
43+
}, [props.onAbortRequest])
44+
4045
return null;
4146
};
4247

@@ -84,6 +89,7 @@ export class SendPage extends React.Component<{
8489

8590
<SendPageKeyboardShortcuts
8691
onMoveSelection={moveSelection}
92+
onAbortRequest={selectedRequest?.pendingSend?.abort}
8793
/>
8894

8995
<TabContentContainer

0 commit comments

Comments
 (0)