[Bug]: Clicks near a text selection keep adding unintended citations to the composer#29209

opened6d agobyPpsick22

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. In an assistant response, double-click a word or drag to select some text.
  2. Wait for the Cite button to appear.
  3. Click about 5px below and to the right of where the pointer stopped, for example to clear the selection.

Expected behavior

The click clears the selection or starts a new one. T3 Code adds a citation only when I click the Cite button on purpose.

Actual behavior

My composer keeps collecting citations I did not ask for. I select text out of habit while reading, and my next click can land on the Cite button before I notice the button. The button opens with its top-left corner at the pointer, so that click cites the text. I often have to remove these citations before I send a message.

After a double-click, the button also opens in the middle of the selected word, not at the end of the selection.

I measured clicks from where the pointer stopped, after both a drag and a double-click. The measurements come from a browser test on main that drives clicks through Playwright. Both gestures gave the same result. Positive offsets move right and down.

Click offset in px (x,y)Cited
+5,+5 and +10,+5Yes
0,0 and +1,+1 and +2,+2 and +3,+3No
-2,-2 and +3,-2 and -2,+3No

Impact

Minor bug or occasional failure

Version or commit

main @ 47f2c8d29e

Environment

macOS 26.5.1 (arm64), T3 Code desktop 0.1.7-nightly.20261101.4016, connected to a server on WSL2 with the same version. I took the measurements above in Chromium on Linux.

Screenshots, recordings, or supporting files

The red dot marks where the pointer stopped.

After a double-click, the Cite button opens at the pointer in the middle of the word

To stop these citations, I propose opening the Cite button below the end of the selection. Keyboard selections already use that position. #17650 made the button follow the pointer when a selection ends on the selected text, so I would like to confirm this direction before I open a PR. I have a small fix with tests ready.

Related: #27666 covers the delay before the button appears. This issue covers where the button opens.

Workaround

Move the pointer away from the Cite button before you click.

Synced from GitHub

I have the exact same option as someone who selects text as they read its driving me insane. Cannot wait for this fix to land!!!