Ignore Alt+<letter> keybinds when focused in chat input

Fixes #3719
This commit is contained in:
Pavel Djundik 2020-01-23 22:50:37 +02:00
parent e8ba4f4fb9
commit 63540e102b
2 changed files with 27 additions and 3 deletions

View file

@ -71,11 +71,27 @@ export default {
clearTimeout(this.dayChangeTimeout);
},
methods: {
toggleSidebar() {
toggleSidebar(e) {
// Do not handle this keybind in the chat input because
// it can be used to type letters with umlauts
if (e.target.tagName === "TEXTAREA") {
return true;
}
this.$store.commit("toggleSidebar");
return false;
},
toggleUserList() {
toggleUserList(e) {
// Do not handle this keybind in the chat input because
// it can be used to type letters with umlauts
if (e.target.tagName === "TEXTAREA") {
return true;
}
this.$store.commit("toggleUserlist");
return false;
},
msUntilNextDay() {
// Compute how many milliseconds are remaining until the next day starts

View file

@ -71,7 +71,15 @@ Mousetrap.bind(["alt+shift+up", "alt+shift+down"], function(e, keys) {
// Jump to the first window with a highlight in it, or the first with unread
// activity if there are none with highlights.
Mousetrap.bind(["alt+a"], function() {
Mousetrap.bind(["alt+a"], function(e) {
// Do not handle this keybind in the chat input because
// it can be used to type letters with umlauts
// Normally this is not required, but since chat input has the "mousetrap"
// class for other keybinds to work, we need to add this check
if (e.target.tagName === "TEXTAREA") {
return true;
}
let targetChannel;
outer_loop: for (const network of store.state.networks) {