Skip to content

Commit

Permalink
fix: hotkey is shift+u
Browse files Browse the repository at this point in the history
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Dec 18, 2024
1 parent 85c5389 commit ec7069e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 2 additions & 3 deletions cypress/components/UploadPicker/hotkeys.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import { Folder, Permission, addNewFileMenuEntry, type Entry } from '@nextcloud/files'
import { generateRemoteUrl } from '@nextcloud/router'
import { UploadPicker } from '../../../lib/index.ts'
import type { ComponentPublicInstance } from 'vue'

describe('UploadPicker: hotkeys testing', () => {
const propsData = {
Expand All @@ -31,7 +30,7 @@ describe('UploadPicker: hotkeys testing', () => {
} as Entry)
})

it('opens the upload menu when pressing u', () => {
it('opens the upload menu when pressing shift+u', () => {
cy.mount(UploadPicker, { propsData })

// Check and init aliases
Expand All @@ -40,7 +39,7 @@ describe('UploadPicker: hotkeys testing', () => {

cy.get('[role="menu"]').should('not.exist')

cy.get('body').type('u')
cy.get('body').type('{shift}u')
cy.get('[role="menu"]').should('be.visible')
})

Expand Down
9 changes: 8 additions & 1 deletion lib/components/UploadPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,13 @@ export default defineComponent({
this.uploadManager.addNotifier(this.onUploadCompletion)

// Register hotkeys
useHotKey(['u', 'Escape'], this.onKeyDown, {
useHotKey('u', this.onKeyDown, {
stop: true,
prevent: true,
shift: true,
})

useHotKey('Escape', this.onKeyDown, {
stop: true,
prevent: true,
})
Expand Down Expand Up @@ -483,6 +489,7 @@ export default defineComponent({
},

onKeyDown(event: KeyboardEvent) {
// Shift + u opens the menu
if (event.key === 'u') {
// If we have a menu, open it
if (this.haveMenu) {
Expand Down

0 comments on commit ec7069e

Please sign in to comment.