Skip to content

Commit 84fecd3

Browse files
iOvergaardAndyButlandCopilotnielslyngsoeclaude
authored
Backoffice: CTRL+Click to open in a new tab should work on Linux (closes #21009) (#21027)
* fix: uses 'href' as property instead of attribute * build: runs on PR to release branches * Content references: Avoid requesting references for content that is not yet persisted server side (#21035) * Avoid requesting references for content that is not yet persisted server side. * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * refactor to use condition * revert * danish translations * da translation --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Niels Lyngsø <[email protected]> * fix: CTRL+Click now opens links in new tab on Linux The router's anchor click handler incorrectly assumed non-Windows platforms use Meta (⌘) key for "open in new tab". This broke CTRL+Click on Linux, which uses CTRL like Windows. Changed detection from "is Windows" to "is Mac" so Linux correctly uses CTRL+Click while Mac continues to use Meta+Click. Also replaced deprecated navigator.platform with navigator.userAgent. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Andy Butland <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Niels Lyngsø <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent c35fcf1 commit 84fecd3

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

.github/workflows/azure-backoffice.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- release/*
78
- v*/dev
89
- v*/main
910
paths:
@@ -15,6 +16,7 @@ on:
1516
types: [opened, synchronize, reopened, closed]
1617
branches:
1718
- main
19+
- release/*
1820
- v*/dev
1921
- v*/main
2022
workflow_dispatch:

src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { UMB_BACKOFFICE_CONTEXT } from '../backoffice.context.js';
22
import type { UmbBackofficeContext } from '../backoffice.context.js';
3-
import type { CSSResultGroup } from '@umbraco-cms/backoffice/external/lit';
43
import { css, customElement, html, ifDefined, repeat, state } from '@umbraco-cms/backoffice/external/lit';
54
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
65
import type { ManifestSection } from '@umbraco-cms/backoffice/section';
@@ -113,15 +112,13 @@ export class UmbBackofficeHeaderSectionsElement extends UmbLitElement {
113112
const label = this.localize.string(manifest?.meta.label || manifest?.name);
114113
return html`<uui-tab
115114
data-mark="section-link:${manifest.alias}"
116-
href=${this.#getSectionPath(manifest)}
115+
.href=${this.#getSectionPath(manifest)}
117116
label=${ifDefined(label)}
118117
?active=${this._currentSectionAlias === manifest.alias}
119-
@click=${(event: PointerEvent) => this.#onSectionClick(event, manifest)}
120-
>${label}</uui-tab
121-
>`;
118+
@click=${(event: PointerEvent) => this.#onSectionClick(event, manifest)}></uui-tab>`;
122119
}
123120

124-
static override styles: CSSResultGroup = [
121+
static override readonly styles = [
125122
css`
126123
:host {
127124
display: contents;

src/Umbraco.Web.UI.Client/src/packages/core/router/router-slot/util/anchor.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
* that has a relative HREF, uses the history API instead.
44
*/
55
export function ensureAnchorHistory() {
6-
const isWindows = navigator.platform.toUpperCase().indexOf('WIN') !== -1;
6+
const isMac = /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);
77

88
window.addEventListener('click', (e: MouseEvent) => {
9-
// If we try to open link in a new tab, then we want to skip skip:
10-
if ((isWindows && e.ctrlKey) || (!isWindows && e.metaKey)) return;
9+
// If we try to open link in a new tab, we want to skip:
10+
// - Mac uses Meta (⌘) + Click
11+
// - Windows and Linux use Ctrl + Click
12+
if ((isMac && e.metaKey) || (!isMac && e.ctrlKey)) return;
1113

1214
// Find the target by using the composed path to get the element through the shadow boundaries.
1315
// Support both HTML anchor tags and SVG anchor tags

0 commit comments

Comments
 (0)