Skip to content

Commit 12334c1

Browse files
skjnldsvAndyScherzinger
authored andcommitted
fix(files): middle click & ctrl new tab
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
1 parent 6b4a6a0 commit 12334c1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apps/files/src/components/FileEntryMixin.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export default defineComponent({
318318

319319
// if ctrl+click / cmd+click (MacOS uses the meta key) or middle mouse button (button & 4), open in new tab
320320
// also if there is no default action use this as a fallback
321-
const metaKeyPressed = event.ctrlKey || event.metaKey || Boolean(event.button & 4)
321+
const metaKeyPressed = event.ctrlKey || event.metaKey || event.button === 1
322322
if (metaKeyPressed || !this.defaultFileAction) {
323323
// If no download permission, then we can not allow to download (direct link) the files
324324
if (isPublicShare() && !isDownloadable(this.source)) {
@@ -330,7 +330,9 @@ export default defineComponent({
330330
: generateUrl('/f/{fileId}', { fileId: this.fileid })
331331
event.preventDefault()
332332
event.stopPropagation()
333-
window.open(url, metaKeyPressed ? '_self' : undefined)
333+
334+
// Open the file in a new tab if the meta key or the middle mouse button is clicked
335+
window.open(url, metaKeyPressed ? '_blank' : '_self')
334336
return
335337
}
336338

0 commit comments

Comments
 (0)