Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent super.transitionTo() call when Cmd+Click is used #482

Merged
merged 2 commits into from
Nov 27, 2020

Conversation

Turbo87
Copy link
Collaborator

@Turbo87 Turbo87 commented Nov 26, 2020

Unfortunately, I screwed up when I implemented #473 😞

Before all of this, when you Cmd+Click a link it would open the link in the same tab by doing transitionTo() and calling preventDefault().

After #473, it would open the link in a new tab, due to the skipped preventDefault(), but it would also navigate to the link in the current tab due to the transitionTo() call that is still happening.

This PR changes the code to skip both preventDefault() and transitionTo() if we detect that the user used a modifier key or a non-primary mouse button. This results in the link only being opened in the new tab, but the current tab staying on the same page.

@Turbo87 Turbo87 added the bug Something isn't working label Nov 26, 2020
Copy link
Owner

@buschtoens buschtoens left a comment

Choose a reason for hiding this comment

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

Perfect!

Sorry that I also didn't catch it in the review. 😅

@buschtoens buschtoens changed the title Prevent super.transitionTo() call when Cmd+Click is used fix: prevent super.transitionTo() call when Cmd+Click is used Nov 27, 2020
@buschtoens buschtoens merged commit 44a4c45 into buschtoens:master Nov 27, 2020
@Turbo87 Turbo87 deleted the fix-cmd-click branch November 27, 2020 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants