-
Notifications
You must be signed in to change notification settings - Fork 535
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
Prevent default clicking on markdown preview links when using openLinksInNewTab
#2718
Prevent default clicking on markdown preview links when using openLinksInNewTab
#2718
Conversation
🦋 Changeset detectedLatest commit: 43ef170 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
// error when clicking the link above. The spy here captures this error | ||
// and will assert that it is called only once, otherwise another error | ||
// in this test has occurred | ||
expect(spy).toHaveBeenCalledTimes(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was previously asserting the buggy behavior - now that we're not navigating the page (the call to window.open is mocked), we don't see any error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 💖
Head branch was pushed to by a user without write access
@joshblack are you able to reenable auto-merge? pushed out a linting fix and I don't have access to merge 🙏 |
@marywhite on it! |
Describe your changes here.
Closes #2717
MarkdownViewer
accepts anopenLinksInNewTab
prop to ensure link previews open in a new tab. Because default is not prevented, navigation is also happening in the working tab.I've also added gone ahead and added
noopener noreferrer
to the call towindow.open
s/o @mattcosta7Screenshots
Before:
link-navigation-before.mov
After:
link-navigation-after.mov
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.