diff options
author | Paul Frazee <pfrazee@gmail.com> | 2024-06-10 11:44:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-10 11:44:13 -0700 |
commit | 90ec22a6749555f48bfd21eec81f877f8eae0524 (patch) | |
tree | 97aa29c86e4ba861dde9e3df470951b9345cb3c2 /src/components/Link.tsx | |
parent | 59f49bef68500c1719ed44470121f553208edc85 (diff) | |
download | voidsky-90ec22a6749555f48bfd21eec81f877f8eae0524.tar.zst |
Add support for new-tab clicks on feeds (#4462)
Diffstat (limited to 'src/components/Link.tsx')
-rw-r--r-- | src/components/Link.tsx | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/components/Link.tsx b/src/components/Link.tsx index a2e952a6e..d8ac829b6 100644 --- a/src/components/Link.tsx +++ b/src/components/Link.tsx @@ -12,7 +12,8 @@ import { isExternalUrl, linkRequiresWarning, } from '#/lib/strings/url-helpers' -import {isNative, isWeb} from '#/platform/detection' +import {isNative} from '#/platform/detection' +import {shouldClickOpenNewTab} from '#/platform/urls' import {useModalControls} from '#/state/modals' import {useOpenLink} from '#/state/preferences/in-app-browser' import {useNavigationDeduped} from 'lib/hooks/useNavigationDeduped' @@ -116,16 +117,7 @@ export function useLink({ if (isExternal) { openLink(href) } else { - /** - * A `GestureResponderEvent`, but cast to `any` to avoid using a bunch - * of @ts-ignore below. - */ - const event = e as any - const isMiddleClick = isWeb && event.button === 1 - const isMetaKey = - isWeb && - (event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) - const shouldOpenInNewTab = isMetaKey || isMiddleClick + const shouldOpenInNewTab = shouldClickOpenNewTab(e) if (isBskyDownloadUrl(href)) { shareUrl(BSKY_DOWNLOAD_URL) |