[BUG] Ctrl+click on a link opens two browser tabs in Windows Terminal: Claude Code activates the link in addition to the terminal
Summary
In Windows Terminal, a single Ctrl+click on a link rendered by Claude Code opens two
browser tabs. The link is activated twice: once by Windows Terminal, which opens OSC 8
hyperlinks on Ctrl+click, and once by Claude Code's own mouse click handling, which is on by
default.
This affects every link Claude Code prints, both bare URLs and markdown links with a label.
Environment
| | |
|---|---|
| Claude Code | 2.1.233 (native install, ~/.local/bin/claude.exe) |
| OS | Windows 11 Pro 10.0.26200 |
| Terminal | Windows Terminal 1.24.11911.0 (WT_SESSION set, TERM_PROGRAM unset) |
| Default browser | Chrome (single UserChoice handler for http/https) |
| Windows Terminal experimental.detectURLs | not overridden, so default (on) |
Reproduction
- Run
claudein Windows Terminal. - Get Claude to print any link.
- Ctrl+click it once, keeping Ctrl held until after the mouse button is released.
- Two tabs open with the same URL.
Releasing Ctrl between mouse-down and mouse-up opens only one tab. That points to the
second activation happening on button release.
A plain click (no Ctrl) on a link opens nothing.
What was ruled out
Each row below was tested rather than assumed. The first three ran in a plain pwsh tab in
the same Windows Terminal, outside Claude Code.
| Hypothesis | Test | Result |
|---|---|---|
| A hook or protocol handler opens the browser twice | inspected settings hooks; checked UrlAssociations UserChoice | no hook opens a browser; single ChromeHTML handler |
| Windows Terminal URL autodetection overlapping the OSC 8 region | Ctrl+click on a bare URL, an OSC 8 link with a non-URL label, and an OSC 8 link whose label is the URL | one tab each |
| Mouse tracking mode changes how the terminal activates hyperlinks | enabled ?1000h + ?1006h, then Ctrl+click on a bare URL and an OSC 8 link | one tab each |
| Screen repainting re-emitting the hyperlink between press and release | repainted the link's line every 80 ms with no mouse tracking, then Ctrl+click | one tab |
| Claude Code handles the click in addition to the terminal | set CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1 | one tab |
So the terminal on its own never duplicates, under any of the conditions tested. The
duplication only appears with Claude Code running.
Apparent cause
Claude Code resolves its mouse mode to one of full, scroll or off, defaulting tofull:
CLAUDE_CODE_DISABLE_MOUSEset ->offorfull- else
CLAUDE_CODE_DISABLE_MOUSE_CLICKSset ->scrollorfull - else
full
With full, Claude Code consumes clicks. Windows Terminal still activates OSC 8 hyperlinks
on Ctrl+click regardless, so the same gesture is served twice.
Workaround
Setting CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1 (mode scroll, which keeps wheel scrolling and
drops click handling) brings it back to one tab. Confirmed on this machine.
Worth noting: it took effect in the running session, without a restart.
The cost is losing click handling elsewhere in the TUI, for example clicking to expand a tool
result, which is a poor trade for users who rely on it.
Suggested direction
When the terminal already activates OSC 8 hyperlinks on the same gesture, Claude Code
opening the URL as well is redundant. Skipping the app-side open for the modifier the
terminal uses would fix it without giving up click handling.
Related
#68568 reports the same symptom, two tabs from one click, in the JetBrains reworked terminal.
The cause there is different: that terminal delivers two click events for one physical
click. This report is about Windows Terminal, where the two activations come from two
different handlers, the terminal and Claude Code.
Showing cached comments. Read the full discussion on GitHub ↗
3 Comments
I have the same problem.
Possible duplicate of #82582 ?
Resolved by disabling Claude Code mouse handling and using the default TUI:
This fixed the issue where clicking a link opened it twice, while keeping normal text selection and scrolling working.