Skip to content

fix(files): middle click & ctrl new tab - #52438

Merged
skjnldsv merged 2 commits into
masterfrom
fix/middle-click
May 7, 2025
Merged

fix(files): middle click & ctrl new tab#52438
skjnldsv merged 2 commits into
masterfrom
fix/middle-click

Conversation

@skjnldsv

Copy link
Copy Markdown
Member

Fix#52380

Regression from #45652

@skjnldsvskjnldsv added this to the Nextcloud 32 milestone Apr 25, 2025
@skjnldsvskjnldsv self-assigned this Apr 25, 2025
@skjnldsv
skjnldsv requested a review from a team as a code ownerApril 25, 2025 13:04
@skjnldsv
skjnldsv requested review from artonge, sorbaugh and susnux and removed request for a teamApril 25, 2025 13:04
@skjnldsv

Copy link
Copy Markdown
MemberAuthor

/backport to stable31

// if ctrl+click / cmd+click (MacOS uses the meta key) or middle mouse button (button & 4), open in new tab
// also if there is no default action use this as a fallback
const metaKeyPressed = event.ctrlKey || event.metaKey || Boolean(event.button & 4)
const metaKeyPressed = event.ctrlKey || event.metaKey || event.button === 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see it should have been Boolean(event.buttons & 4) (missing s).
So its an binary mask for bit 4 which means mouse wheel.

But then also the condition in line 330 is wrong.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean line 348 is also wrong ?

image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes button vs buttons

@juliusknorr

Copy link
Copy Markdown
Member

Any way we can add a test for this? I feel this broke quite a few times in the past already

@susnux

Copy link
Copy Markdown
Contributor

Any way we can add a test for this? I feel this broke quite a few times in the past already

At least not checking new tab is opened with Cypress. Does not work by design and would need a different test runner like playwright

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@susnux
susnuxforce-pushed the fix/middle-click branch from 515f8e3 to c446274CompareMay 7, 2025 08:29
@susnux

Copy link
Copy Markdown
Contributor

/compile

Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@skjnldsv
skjnldsv merged commit e3e6a3b into masterMay 7, 2025
@skjnldsv
skjnldsv deleted the fix/middle-click branch May 7, 2025 08:53
@skjnldsvskjnldsv mentioned this pull request Aug 19, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: The hotkeys Middle-Click and Ctrl + Left-Click not open File/Folder in new tab

5 participants

@skjnldsv@juliusknorr@susnux@artonge@nextcloud-command