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
Links to metabase URLs should open in the same window in link cards #41508
Conversation
Codenotify: Notifying subscribers in CODENOTIFY files for diff c288e4d...1374c28.
|
|
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 works great 👍
Re:
An open question is how should we handle invalid relative links in external link cards.
As they're already broken, I don't think we have to do anything. The only thing we change here is to open them in the same tab rather than on the new page, but the behavior of the open pages remains the same.
I think users would likely be able to spot broken links and fix them themselves pretty easily.
@heypoom Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone? |
…41508) * external link cards should apply the correct target attribute * add unit tests for absolute and relative question links in link cards
Partially fixes #30891
Description
External link cards currently always opens in new tabs. When clicking on a link to metabase urls, such as
https://example.com/question/1-some-question
, it opens a new tab instead of opening in the same window. This makes the URL break out of embedding as well.This PR makes it so links with the same origin or same as the site url open in the same window.
Caveat
This also causes all relative links to open in the same tab. This would make relative links to questions and dashboards open correctly, but invalid relative links such as
example.com
,www.example.com
,foobar
will remain broken. An open question is how should we handle invalid relative links in external link cards.How to verify
https://localhost:3000/dashboard/1-example
dashboard/1-example
Checklist