Skip to content

Commit 53503ef

Browse files
authored
Fix client navigation check in Firefox (#5106)
1 parent 651e413 commit 53503ef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/@react-aria/utils/src/openLink.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ interface Modifiers {
6969
}
7070

7171
export function shouldClientNavigate(link: HTMLAnchorElement, modifiers: Modifiers) {
72+
// Use getAttribute here instead of link.target. Firefox will default link.target to "_parent" when inside an iframe.
73+
let target = link.getAttribute('target');
7274
return (
73-
(!link.target || link.target === '_self') &&
75+
(!target || target === '_self') &&
7476
link.origin === location.origin &&
7577
!link.hasAttribute('download') &&
7678
!modifiers.metaKey && // open in new tab (mac)

0 commit comments

Comments
 (0)