mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Router: Fix broken link interception and router navigation (#65023)
* Router: Fix broken link interception and router navigation * replace with instanceof Element
This commit is contained in:
parent
4a80233bed
commit
769b4598d7
@ -3,7 +3,7 @@ import { locationService, navigationLogger } from '@grafana/runtime';
|
||||
import { config } from 'app/core/config';
|
||||
|
||||
export function interceptLinkClicks(e: MouseEvent) {
|
||||
const anchor = e.target instanceof HTMLElement ? getParentAnchor(e.target) : null;
|
||||
const anchor = e.target instanceof Element && getParentAnchor(e.target);
|
||||
|
||||
// Ignore if opening new tab or already default prevented
|
||||
if (e.ctrlKey || e.metaKey || e.defaultPrevented) {
|
||||
@ -43,7 +43,7 @@ export function interceptLinkClicks(e: MouseEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
function getParentAnchor(element: HTMLElement | null): HTMLElement | null {
|
||||
function getParentAnchor(element: Element | null): Element | null {
|
||||
while (element !== null && element.tagName) {
|
||||
if (element.tagName.toUpperCase() === 'A') {
|
||||
return element;
|
||||
|
Loading…
Reference in New Issue
Block a user