From 8bf4e5533851886057687b46a41f1cd88e4cd810 Mon Sep 17 00:00:00 2001 From: syuilo <syuilotan@yahoo.co.jp> Date: Tue, 18 Sep 2018 16:45:20 +0900 Subject: [PATCH] Improve keyboard shortcuts --- src/client/app/common/views/components/menu.vue | 4 ++-- .../app/common/views/components/reaction-picker.vue | 4 ++-- src/client/app/desktop/views/components/notes.note.vue | 10 ++++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/client/app/common/views/components/menu.vue b/src/client/app/common/views/components/menu.vue index fba7e235e0..ad5ec619ba 100644 --- a/src/client/app/common/views/components/menu.vue +++ b/src/client/app/common/views/components/menu.vue @@ -2,9 +2,9 @@ <div class="onchrpzrvnoruiaenfcqvccjfuupzzwv"> <div class="backdrop" ref="backdrop" @click="close"></div> <div class="popover" :class="{ hukidasi }" ref="popover"> - <template v-for="item in items"> + <template v-for="item, i in items"> <div v-if="item === null"></div> - <button v-if="item" @click="clicked(item.action)" v-html="item.icon ? item.icon + ' ' + item.text : item.text"></button> + <button v-if="item" @click="clicked(item.action)" v-html="item.icon ? item.icon + ' ' + item.text : item.text" :tabindex="i"></button> </template> </div> </div> diff --git a/src/client/app/common/views/components/reaction-picker.vue b/src/client/app/common/views/components/reaction-picker.vue index fff2c56f00..f732e40b9d 100644 --- a/src/client/app/common/views/components/reaction-picker.vue +++ b/src/client/app/common/views/components/reaction-picker.vue @@ -97,10 +97,10 @@ export default Vue.extend({ watch: { focus(i) { - this.$refs.buttons.childNodes[i].focus(); + this.$refs.buttons.children[i].focus(); if (this.showFocus) { - this.title = this.$refs.buttons.childNodes[i].title; + this.title = this.$refs.buttons.children[i].title; } } }, diff --git a/src/client/app/desktop/views/components/notes.note.vue b/src/client/app/desktop/views/components/notes.note.vue index e2c61dabe8..d1178a933a 100644 --- a/src/client/app/desktop/views/components/notes.note.vue +++ b/src/client/app/desktop/views/components/notes.note.vue @@ -51,7 +51,7 @@ <button class="reactionButton" :class="{ reacted: p.myReaction != null }" @click="react()" ref="reactButton" title="%i18n:@add-reaction%"> %fa:plus%<p class="count" v-if="p.reactions_count > 0">{{ p.reactions_count }}</p> </button> - <button @click="menu" ref="menuButton"> + <button @click="menu()" ref="menuButton"> %fa:ellipsis-h% </button> <!-- <button title="%i18n:@detail"> @@ -114,11 +114,12 @@ export default Vue.extend({ keymap(): any { return { 'r|left': () => this.reply(true), - 'a|plus': () => this.react(true), + 'e|a|plus': () => this.react(true), 'q|right': () => this.renote(true), 'ctrl+q|ctrl+right': this.renoteDirectly, 'up|k|shift+tab': this.focusBefore, 'down|j|tab': this.focusAfter, + 'm|o': () => this.menu(true), '1': () => this.reactDirectly('like'), '2': () => this.reactDirectly('love'), '3': () => this.reactDirectly('laugh'), @@ -278,10 +279,11 @@ export default Vue.extend({ }); }, - menu() { + menu(viaKeyboard = false) { (this as any).os.new(MkNoteMenu, { source: this.$refs.menuButton, - note: this.p + note: this.p, + animation: !viaKeyboard }).$once('closed', this.focus); },