Skip to content

Commit 4ae5721

Browse files
committed
Merge branch 'frontend-send-esc'
2 parents 5a22854 + 3947c24 commit 4ae5721

File tree

1 file changed

+3
-10
lines changed
  • frontends/web/src/routes/account/send

1 file changed

+3
-10
lines changed

frontends/web/src/routes/account/send/send.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ class Send extends Component<Props, State> {
166166
}
167167
}),
168168
];
169-
}
170169

171-
public UNSAFE_componentWillMount() {
172170
this.registerEvents();
173171
}
174172

@@ -177,16 +175,11 @@ class Send extends Component<Props, State> {
177175
unsubscribe(this.unsubscribeList);
178176
}
179177

180-
private registerEvents = () => {
181-
document.addEventListener('keydown', this.handleKeyDown);
182-
};
183-
184-
private unregisterEvents = () => {
185-
document.removeEventListener('keydown', this.handleKeyDown);
186-
};
178+
private registerEvents = () => document.addEventListener('keydown', this.handleKeyDown);
179+
private unregisterEvents = () => document.removeEventListener('keydown', this.handleKeyDown);
187180

188181
private handleKeyDown = (e: KeyboardEvent) => {
189-
if (e.keyCode === 27 && !this.state.activeCoinControl && !this.state.activeScanQR) {
182+
if (e.key === 'Escape' && !this.state.activeCoinControl && !this.state.activeScanQR) {
190183
route(`/account/${this.props.code}`);
191184
}
192185
};

0 commit comments

Comments
 (0)