Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Better onRootClick implementation

Chocobozzzd5323a641b4a
diff --git a/client/src/app/shared/shared-plugin-pages/plugin-pages.component.ts b/client/src/app/shared/shared-plugin-pages/plugin-pages.component.ts
index 986d341d37..fb449b4789 100644
--- a/client/src/app/shared/shared-plugin-pages/plugin-pages.component.ts
+++ b/client/src/app/shared/shared-plugin-pages/plugin-pages.component.ts
@@ -34,16 +34,15 @@ export class PluginPagesComponent implements OnDestroy, AfterViewInit {
onRootClick (event: Event) {
const target = event.target as HTMLElement
-
if (!target) return
- if (target.tagName !== 'A') return
- const a = target as HTMLAnchorElement
+ const a = target.closest('a')
+ if (!a) return
// Get the href attribute set by the dev, not the one calculated by JS to detect if it's a relative/external link
const href = a.getAttribute('href')
- if (a.target !== '_blank' && href.startsWith('/')) {
+ if (!a.target && href.startsWith('/')) {
event.preventDefault()
event.stopPropagation()