diff --git a/apps/web/src/components/desktopUpdate.toast.tsx b/apps/web/src/components/desktopUpdate.toast.tsx
index 004a76a81cd7..4e55f3a28d12 100644
--- a/apps/web/src/components/desktopUpdate.toast.tsx
+++ b/apps/web/src/components/desktopUpdate.toast.tsx
@@ -18,7 +18,7 @@ function ReleaseNotesLink({
}) {
return (
);
}
diff --git a/apps/web/src/components/ui/tooltip.tsx b/apps/web/src/components/ui/tooltip.tsx
index 5a891990cb1a..77b15a01e16b 100644
--- a/apps/web/src/components/ui/tooltip.tsx
+++ b/apps/web/src/components/ui/tooltip.tsx
@@ -33,7 +33,7 @@ function TooltipPopup({
{
@@ -34,6 +35,17 @@ describe("openPullRequestLink", () => {
});
});
+describe("shouldOpenPullRequestExternally", () => {
+ it("uses the browser for command-click and control-click", () => {
+ expect(shouldOpenPullRequestExternally({ metaKey: true, ctrlKey: false })).toBe(true);
+ expect(shouldOpenPullRequestExternally({ metaKey: false, ctrlKey: true })).toBe(true);
+ });
+
+ it("keeps an unmodified click in the pull request view", () => {
+ expect(shouldOpenPullRequestExternally({ metaKey: false, ctrlKey: false })).toBe(false);
+ });
+});
+
describe("parseChangeRequestUrl", () => {
it("reads a GitHub pull request", () => {
expect(parseChangeRequestUrl("https://github.com/T3Tools/T3Code/pull/123")).toEqual({
diff --git a/apps/web/src/lib/openPullRequestLink.ts b/apps/web/src/lib/openPullRequestLink.ts
index 951c02e4b4df..8943f907b3fd 100644
--- a/apps/web/src/lib/openPullRequestLink.ts
+++ b/apps/web/src/lib/openPullRequestLink.ts
@@ -173,10 +173,19 @@ export function findProjectForChangeRequest(
* should still be reading it afterwards. Any change request opens there, not only the thread's
* own, since the panel is told which one to show.
*/
+export function shouldOpenPullRequestExternally(
+ event: Pick, "metaKey" | "ctrlKey">,
+): boolean {
+ return event.metaKey || event.ctrlKey;
+}
+
export function useOpenChangeRequestLink(
threadRef?: ScopedThreadRef,
): (
- event: Pick, "preventDefault" | "stopPropagation">,
+ event: Pick<
+ MouseEvent,
+ "preventDefault" | "stopPropagation" | "metaKey" | "ctrlKey"
+ >,
targetUrl: string,
targetThreadRef?: ScopedThreadRef,
) => boolean {
@@ -186,6 +195,7 @@ export function useOpenChangeRequestLink(
const primaryEnvironmentId = usePrimaryEnvironmentId();
return useCallback(
(event, targetUrl, targetThreadRef) => {
+ if (shouldOpenPullRequestExternally(event)) return false;
const resolvedThreadRef = targetThreadRef ?? threadRef;
const environmentId = resolvedThreadRef?.environmentId ?? primaryEnvironmentId;
if (