Skip to content

Add open link behavior options for articles and links - #8990

Closed
Inverle wants to merge 7 commits into
FreshRSS:edgefrom
Inverle:link-open-behavior
Closed

Inverle wants to merge 7 commits into
FreshRSS:edgefrom
Inverle:link-open-behavior

Conversation

@Inverle

@Inverle Inverle commented Jul 5, 2026 •

Copy link
Copy Markdown
Member

Closes #1256 (Safari not tested/implemented)

Solves it by:

  • Allowing use of Ctrl/Shift keys while using the open website shortcut, this will cause the article to open in a new background tab, only works on Firefox though.
  • Adding an option for default link open behavior, Open in new background tab, in this case, which can be applied either only to the shortcut or both shortcut and button. Also works only on Firefox.

I tried to make the option work on Chromium too, but the method I found for doing that was patched recently in v150:

image

https://gist.github.com/Inverle/d79be2c30ed9b5b2aba8e09c507a4ea9
new: https://gist.github.com/Inverle/27dee6e393e2d165e429f0464cccf83f

(and when I found it, I was running an outdated version of Chromium, so this is quite unlucky - the first stable build with the fix was released 2026-06-30, so basically 5 days ago..)

edit: I found a new way, I'm not sure how easy it will be to integrate though

In addition:

  • Options Open in new tab (already default) / Open in current tab
  • Setting for if the option should be also applied to external links in articles

@Inverle Inverle added this to the 1.30.0 milestone Jul 5, 2026
@Inverle
Inverle requested review from Alkarex and Frenzie July 5, 2026 12:32
@Inverle Inverle added Shortcuts ⌨ javascript Pull requests that update Javascript code labels Jul 5, 2026
@Inverle

Inverle commented Jul 5, 2026 •

Copy link
Copy Markdown
Member Author

I tried to make the option work on Chromium too, but the method I found for doing that was patched recently in v150:

This could be one of the commits which fixed it:
https://chromium.googlesource.com/chromium/src.git/+/aa69447f800b764e509b2cb1cce83f006df4db0b%5E%21/

The bug is privated though: https://issues.chromium.org/issues/503371806

edit: I found a new way, I'm not sure how easy it will be to integrate though

@Frenzie

Frenzie commented Jul 5, 2026

Copy link
Copy Markdown
Member

Inverle requested review

This kind of behavior isn't something browsers are very fond of due to abuse in the past, but I imagine you already considered that before writing the code. Are you asking for an opinion on something specific? The JS looks good to me as an implementation of what's described in the OP.

@Alkarex

Alkarex commented Jul 7, 2026

Copy link
Copy Markdown
Member

As this is a bit non-standard, any chance this could be in an extension?

@Inverle

Inverle commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

As this is a bit non-standard, any chance this could be in an extension?

The Open in new background tab option is indeed a bit fragile, or more precisely, Chrome has a problem with it. But:

Allowing use of Ctrl/Shift keys while using the open website shortcut

seems like a fair change, as well as the Open in current tab option, so what exactly should be in an extension?

@Frenzie

Frenzie commented Jul 7, 2026

Copy link
Copy Markdown
Member

It seems somewhat unlikely that the synthetic event will keep working that way in Firefox in the long term.

@Alkarex

Alkarex commented Jul 7, 2026

Copy link
Copy Markdown
Member

I am afraid those mechanisms have been a cat/mouse game for some time and will likely continue with some instability. In particular, if possible, I would prefer code requiring user-agent detection to be in an extension.

@Inverle

Inverle commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

I am afraid those mechanisms have been a cat/mouse game for some time and will likely continue with some instability. In particular, if possible, I would prefer code requiring user-agent detection to be in an extension.

It doesn't require user agent detection, it's just for clarity. I can remove it, and the code will continue to fallback to opening in a new tab (not in background if not supported)

@Inverle

Inverle commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

It seems somewhat unlikely that the synthetic event will keep working that way in Firefox in the long term.

So it is a bug in Firefox, but maybe an intended one.
I was trying to see if this worked in older Firefox, and it only started working in Firefox 96.
In the changelog (https://www.firefox.com/en-US/firefox/96.0/releasenotes/) you can see this note:

On macOS, command-clicking links in Gmail now opens them in a new tab as expected.

See: https://bugzilla.mozilla.org/show_bug.cgi?id=1739929

The code change that was made: https://phabricator.services.mozilla.com/D131868#differential-review-stage

Potentially, the unintended part is that now untrusted events can trigger such clicks (with Ctrl key), but it is not checked if Ctrl is actually being pressed, unlike in Chrome.

This is working for 4 years now though.

@Alkarex

Alkarex commented Jul 7, 2026

Copy link
Copy Markdown
Member

command-clicking links in Gmail now opens them in a new tab as expected

It looks like the problem was about opening in a new tab, not the background part, was it? In our case, isn't it solely the background part that does not exist?

@Frenzie

Frenzie commented Jul 7, 2026

Copy link
Copy Markdown
Member

Apparently they're no rush (16 years and counting), but they didn't reject it… https://bugzilla.mozilla.org/show_bug.cgi?id=565104

@Inverle

Inverle commented Aug 8, 2026

Copy link
Copy Markdown
Member Author

I made a minimal PR only for the modifiers change: #9186

I will probably turn the rest of this PR into an extension, as suggested: #8990 (comment)

@Inverle Inverle closed this Aug 8, 2026
Alkarex pushed a commit that referenced this pull request Aug 9, 2026
Minimal changes borrowed from #8990

Allows usage of <kbd>Ctrl/Shift</kbd> keys with the open website shortcut, so that you can open an article either in a new background tab or a new window.

Doesn't work in Chromium browsers, the website opens normally in a new tab there instead. (Firefox only)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update Javascript code Shortcuts ⌨

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open article in new background tab shortcut

3 participants