Skip to content

Commit

Permalink
Merge pull request #621 from Adamant-im/fix/scroll-commands
Browse files Browse the repository at this point in the history
fix: scroll between commands only when the input field focused
  • Loading branch information
RealGoodProgrammer authored May 2, 2024
2 parents 2f45348 + 765369a commit 53a8366
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/AChat/AChatForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
color="primary"
v-on="listeners"
:autofocus="isDesktopDevice"
@focusin="isInputFocused = true"
@focusout="isInputFocused = false"
>
<template #prepend-inner>
<chat-emojis
Expand Down Expand Up @@ -84,7 +86,8 @@ export default {
message: '',
emojiPickerOpen: false,
botCommandIndex: null,
botCommandSelectionMode: false
botCommandSelectionMode: false,
isInputFocused: false
}),
computed: {
isDesktopDevice: () => !isMobile(),
Expand Down Expand Up @@ -157,7 +160,7 @@ export default {
onKeyCommand: function (event) {
if (event.ctrlKey && event.shiftKey && event.code === 'Digit1') {
this.openElement()
} else if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
} else if (this.isInputFocused && (event.code === 'ArrowUp' || event.code === 'ArrowDown')) {
this.selectCommand(event.code)
event.preventDefault()
} else if (event.key.length === 1) {
Expand Down

0 comments on commit 53a8366

Please sign in to comment.