Don't focus new tab on middle click

This is more in line with how the browser behaves on middle click
This commit is contained in:
Svilen Markov 2024-11-17 10:06:54 +00:00
parent af4c1e8514
commit afe6ad6bfc
2 changed files with 5 additions and 3 deletions

View File

@ -262,7 +262,7 @@ function setupGroups() {
return;
}
openURLInNewTab(title.dataset.titleUrl);
openURLInNewTab(title.dataset.titleUrl, false);
event.preventDefault();
});
}

View File

@ -28,6 +28,8 @@ export function clamp(value, min, max) {
return Math.min(Math.max(value, min), max);
}
export function openURLInNewTab(url) {
window.open(url, '_blank', 'noopener,noreferrer')?.focus();
export function openURLInNewTab(url, focus = true) {
const newWindow = window.open(url, '_blank', 'noopener,noreferrer');
if (focus && newWindow != null) newWindow.focus();
}