You know the one. Claude asks a question, you click on the terminal to give it focus, and the pointer lands on one of the answers. You just approved something you never wanted to approve. There is a setting for that.
This is part 6 of a series on hidden Claude Code settings. Part 1: the terminal flicker fix. Part 2: the skills listing budget. Part 3: the session history cleanup. Part 4: remote control at startup. Part 5: turning off forced git worktrees. The original version was a tweet in Hebrew.
Why does clicking the terminal answer a Claude Code prompt?
Claude Code turns on mouse tracking in your terminal. That is what lets you click an option in a prompt instead of arrowing down to it, and what lets the scroll wheel move the Claude Code view rather than your terminal's scrollback.
The side effect is that there is no such thing as a click that only focuses the window. If the window was in the background and you click it so you can start typing, that click still gets delivered to whatever sits under the pointer. When what sits under the pointer is option 2 of a permission prompt, you have answered the prompt.
A click meant to focus the window is still a click on whatever is underneath it.
The fix: CLAUDE_CODE_DISABLE_MOUSE_CLICKS
One environment variable turns off click handling and leaves the scroll wheel alone. In the env block of your settings.json:
{
"env": {
"CLAUDE_CODE_DISABLE_MOUSE_CLICKS": "1"
}
}
Or in your shell profile, if you would rather have it follow you everywhere:
export CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1
From that moment on, choosing an answer works with the arrow keys and Enter, and only with the arrow keys and Enter. Clicking the window does what you actually meant: it focuses the window.
What is the trade-off?
It also kills drag select. You can no longer highlight text by dragging the mouse across it, which is a real loss if that is how you copy a path or an error message out of a session. I would be glad if the two were separable, because they are genuinely different things, but today they are not.
If you already copy text through tmux copy mode or a keyboard-driven terminal, you will not feel it at all.
What if I want the mouse off entirely?
There is a bigger hammer. This one turns off mouse tracking completely, wheel included, and hands you back your terminal's native copy-on-select and scrollback:
export CLAUDE_CODE_DISABLE_MOUSE=1
Pick based on what you actually do in the terminal. If you scroll the Claude Code view with the wheel constantly, take the narrow one. If you mostly select and copy text and scroll with your terminal's own keybindings, take the full one and enjoy having a normal terminal again.
Found more settings worth knowing? Tell me on X. And if your team is running coding agents with nobody owning the configuration, sorting out setups like this is part of what I do in AI consulting engagements.
FAQ
How do I stop Claude Code from selecting a prompt answer when I click the terminal?
Set CLAUDE_CODE_DISABLE_MOUSE_CLICKS to 1, either in the env block of your Claude Code settings.json or as an export in your shell profile. Claude Code stops handling mouse clicks, so a click only focuses the terminal window and prompt answers can only be chosen with the arrow keys and Enter. The scroll wheel keeps working.
What is the difference between CLAUDE_CODE_DISABLE_MOUSE_CLICKS and CLAUDE_CODE_DISABLE_MOUSE?
CLAUDE_CODE_DISABLE_MOUSE_CLICKS turns off click handling but keeps mouse tracking on, so scrolling with the wheel still scrolls the Claude Code view. CLAUDE_CODE_DISABLE_MOUSE turns off mouse tracking entirely, which also gives you back your terminal's native copy-on-select and scrollback, at the cost of losing wheel scrolling inside Claude Code.