Skip to content

Commit 1a13a43

Browse files
committed
Brought in bugfix/esc-key-event.
Signed-off-by: ubi de feo <[email protected]>
2 parents 5a7bd0f + cc93543 commit 1a13a43

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

backend/shortcuts.js

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module.exports = {
1111
CLEAR_TERMINAL: 'CommandOrControl+L',
1212
EDITOR_VIEW: 'CommandOrControl+Alt+1',
1313
FILES_VIEW: 'CommandOrControl+Alt+2',
14-
ESC: 'Escape'
1514
},
1615
menu: {
1716
CONNECT: 'CmdOrCtrl+Shift+C',

ui/arduino/store.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -1463,14 +1463,11 @@ async function store(state, emitter) {
14631463
if (state.view != 'editor') return
14641464
emitter.emit('change-view', 'file-manager')
14651465
}
1466-
if (key === shortcuts.ESC) {
1467-
if (state.isConnectionDialogOpen) {
1468-
emitter.emit('close-connection-dialog')
1469-
}
1470-
if (state.isNewFileDialogOpen) {
1471-
emitter.emit('close-new-file-dialog')
1472-
}
1473-
}
1466+
// if (key === shortcuts.ESC) {
1467+
// if (state.isConnectionDialogOpen) {
1468+
// emitter.emit('close-connection-dialog')
1469+
// }
1470+
// }
14741471

14751472
})
14761473

ui/arduino/views/components/connection-dialog.js

+13
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ function ConnectionDialog(state, emit) {
66
}
77
}
88

9+
function onKeyDown(e) {
10+
if (e.key.toLowerCase() === 'escape') {
11+
emit('close-connection-dialog')
12+
}
13+
}
14+
15+
// Add/remove event listener based on dialog state
16+
if (state.isConnectionDialogOpen) {
17+
document.addEventListener('keydown', onKeyDown)
18+
} else {
19+
document.removeEventListener('keydown', onKeyDown)
20+
}
21+
922
return html`
1023
<div id="dialog-connection" class="dialog ${stateClass}" onclick=${onClick}>
1124
<div class="dialog-content">

0 commit comments

Comments
 (0)