Skip to content

[VS Code] Bug: Quick chat grabs focus when clicking elsewhere in the editor

Checklist

Summary

After opening a quick chat, clicking anywhere within the editor pane causes quick chat to steal focus. If the chat is scrolled out of view, it will snap back into focus.

Steps to reproduce

  1. Open quick chat (e.g. Option + C) and ask a question.
  2. Focus inside the quick chat by clicking.
  3. Focus outside the quick chat by clicking or selecting elsewhere in the editor.

What is the current bug behavior?

The focus travels back to the last selected quick chat element immediately after clicking.

What is the expected correct behavior?

The focus should remain where the user clicked.

Relevant logs and/or screenshots

quick_chat_glitch

Possible fixes

I've narrowed it down to this line in #updateThreadLabel:

      this.#thread.label = newText;

Updating the label text causes the sub-editor (which the quick chat has created) to grab focus.

  1. Immediate fix: Disable the label change feature by removing this line. Or reverting !2032 (merged).
  2. Longer term fix: Figure out why this causes the focus to be grabbed. Potentially we'll have to allow the focus to change, and then restore to focus back to the cursor in the parent editor.
Edited by Tristan Read