Skip to content

Commit 98b6de8

Browse files
fix: allow Enter on public share Download link
Signed-off-by: Kristian Zendato <kristian.zendato@nextcloud.com>
1 parent e88740d commit 98b6de8

4 files changed

Lines changed: 27 additions & 8 deletions

File tree

apps/files/src/components/FileEntry.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,21 +277,21 @@ export default defineComponent({
277277
},
278278
279279
created() {
280-
useHotKey('Enter', this.triggerDefaultAction, {
281-
stop: true,
282-
prevent: true,
283-
})
280+
useHotKey('Enter', this.triggerDefaultAction)
284281
},
285282
286283
methods: {
287284
formatFileSize,
288285
289-
triggerDefaultAction() {
286+
triggerDefaultAction(event?: KeyboardEvent) {
290287
// Don't react to the event if the file row is not active
291288
if (!this.isActive) {
292289
return
293290
}
294291
292+
event?.preventDefault()
293+
event?.stopPropagation()
294+
295295
this.defaultFileAction?.exec({
296296
nodes: [this.source],
297297
folder: this.activeFolder!,

cypress/e2e/files_sharing/public-share/header-menu.cy.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,25 @@ describe('files_sharing: Public share - header actions menu', { testIsolation: t
3737
]))
3838
})
3939

40+
it('Can download all files with keyboard', () => {
41+
cy.get('header')
42+
.findByRole('button', { name: 'Download' })
43+
.should('be.visible')
44+
.focus()
45+
.type('{enter}')
46+
47+
const downloadsFolder = Cypress.config('downloadsFolder')
48+
cy.readFile(`${downloadsFolder}/shared.zip`, null, { timeout: 15000 })
49+
.should('exist')
50+
.and('have.length.gt', 30)
51+
.and(zipFileContains([
52+
'shared/',
53+
'shared/foo.txt',
54+
'shared/subfolder/',
55+
'shared/subfolder/bar.txt',
56+
]))
57+
})
58+
4059
it('Can copy direct link', () => {
4160
// Check the button
4261
cy.get('header')

dist/files-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)