MCPcopy Index your code
hub / github.com/adobe/react-spectrum / shouldClientNavigate

Function shouldClientNavigate

packages/react-aria/src/utils/openLink.tsx:92–104  ·  view source on GitHub ↗
(link: HTMLAnchorElement, modifiers: Modifiers)

Source from the content-addressed store, hash-verified

90}
91
92export function shouldClientNavigate(link: HTMLAnchorElement, modifiers: Modifiers): boolean {
93 // Use getAttribute here instead of link.target. Firefox will default link.target to "_parent" when inside an iframe.
94 let target = link.getAttribute('target');
95 return (
96 (!target || target === '_self') &&
97 link.origin === location.origin &&
98 !link.hasAttribute('download') &&
99 !modifiers.metaKey && // open in new tab (mac)
100 !modifiers.ctrlKey && // open in new tab (windows)
101 !modifiers.altKey && // download
102 !modifiers.shiftKey
103 );
104}
105
106export function openLink(target: HTMLAnchorElement, modifiers: Modifiers, setOpening = true): void {
107 let {metaKey, ctrlKey, altKey, shiftKey} = modifiers;

Callers 2

RouterProviderFunction · 0.85
handleLinkClickFunction · 0.85

Calls 1

hasAttributeMethod · 0.80

Tested by

no test coverage detected