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

Handling of external links with target="_blank" #1176

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

veloman-yunkan
Copy link
Collaborator

Fixes kiwix/kiwix-tools#678

External links with target="_blank" attribute are opened in a new tab/window.

External links with target="_blank" attribute are opened in a new tab/window.
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.47%. Comparing base (664944f) to head (9e756a4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1176   +/-   ##
=======================================
  Coverage   41.47%   41.47%           
=======================================
  Files          59       59           
  Lines        4272     4272           
  Branches     2336     2336           
=======================================
  Hits         1772     1772           
  Misses        999      999           
  Partials     1501     1501           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -355,7 +359,7 @@ function onClickEvent(e) {

if (isExternalAppUrl || isExternalUrl(target_href)) {
const possiblyBlockedLink = blockLink(target_href);
if ( e.ctrlKey || e.shiftKey ) {
if ( e.ctrlKey || e.shiftKey || linkShouldBeOpenedInANewWindow(target) ) {

Choose a reason for hiding this comment

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

That's very interesting, this is why it is also not working with MacOS command (⌘) key. I did not dared to speak about it in the issue. I should. I think we should add at least e.metaKey to this list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handling of target="_blank" links in kiwix-serve is not working properly inside the viewer
2 participants