fix: Reject keyboard shortcut listeners if input box is active (#3019)

Reject keyboard shortcut listeners if input box is active
This commit is contained in:
Pranav Raj S
2021-09-15 20:15:06 +05:30
committed by GitHub
parent a14f4ede87
commit 3abcadb5cb
7 changed files with 84 additions and 37 deletions

View File

@@ -59,17 +59,10 @@
import { mapGetters } from 'vuex';
import router from '../../routes';
import {
hasPressedAltAndCKey,
hasPressedAltAndVKey,
hasPressedAltAndRKey,
hasPressedAltAndSKey,
} from 'shared/helpers/KeyboardHelpers';
import adminMixin from '../../mixins/isAdmin';
import eventListenerMixins from 'shared/mixins/eventListenerMixins';
import { getInboxClassByType } from 'dashboard/helper/inbox';
export default {
mixins: [adminMixin, eventListenerMixins],
mixins: [adminMixin],
props: {
menuItem: {
type: Object,
@@ -124,20 +117,6 @@ export default {
}
}
},
handleKeyEvents(e) {
if (hasPressedAltAndCKey(e)) {
router.push({ name: 'home' });
}
if (hasPressedAltAndVKey(e)) {
router.push({ name: 'contacts_dashboard' });
}
if (hasPressedAltAndRKey(e)) {
router.push({ name: 'settings_account_reports' });
}
if (hasPressedAltAndSKey(e)) {
router.push({ name: 'settings_home' });
}
},
showItem(item) {
return this.isAdmin && item.newLink !== undefined;
},