1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-02-19 20:55:55 +01:00

app: close saveditempane on escape key

This commit is contained in:
Kushagra Gour 2019-03-18 16:11:48 +05:30
parent c5462aab4c
commit c6708ad034

View File

@ -554,8 +554,14 @@ export default class App extends Component {
isKeyboardShortcutsModalOpen: !this.state.isKeyboardShortcutsModalOpen
});
trackEvent('ui', 'showKeyboardShortcutsShortcut');
} else if (event.keyCode === 27 && event.target.tagName !== 'INPUT') {
// We might be listening on keydown for some input inside the app. In that case
} else if (
event.keyCode === 27 &&
(event.target.tagName !== 'INPUT' || event.target.id === 'searchInput')
) {
// ESCAPE
// TODO: whats written next doesn't make sense. Review it.
// We might be listening on keydown for some input inside the app, UNLESS its
// the search input in saved items pane. In that case
// we don't want this to trigger which in turn focuses back the last editor.
this.closeSavedItemsPane();
} else if ((event.ctrlKey || event.metaKey) && event.keyCode === 80) {