Skip to content

The editor/console (sometimes) loses focus when commands that open an interactive viewer are executed #1658

Open

Description

@ThomasSoeiro

Describe the bug

The editor/console (sometimes) loses focus when commands that open an interactive viewer are executed. We must then click again in the editor/console to get focus back.

To Reproduce

I am not able to always reproduce, but the editor/console often loses focus when executing e.g.:

plot(mpg ~ hp, mtcars)
View(mtcars)
?plot

Can you fix this issue by yourself? (We appreciate the help)

No

Expected behavior

The editor/console should not lose focus when an interactive viewer is opened.

Environment (please complete the following information):

  • OS: all
  • VSCode Version: VSCodium 1.106.37943
  • R Version: all
  • vscode-R version: 2.8.6

Additional context

FWIW, RStudio editor does not lose focus when showing plots (e.g. plot(mpg ~ hp, mtcars)) or help (e.g. ?plot). With default layout, the editor lose focus when showing objects (e.g. View(mtcars)) because the viewer is open "on top" of the editor.

Activity

  1. ThomasSoeiro commented on Dec 11, 2025

    @ThomasSoeiro
    CollaboratorAuthor

    I confirm the issue also exists with lastest upstream VSCode:

    Version: 1.107.0
    Commit: 618725e67565b290ba4da6fe2d29f8fa1d4e3622
    Date: 2025-12-10T07:43:47.883Z
    Electron: 39.2.3
    ElectronBuildId: 12895514
    Chromium: 142.0.7444.175
    Node.js: 22.21.1
    V8: 14.2.231.21-electron.0
    OS: Windows_NT x64 10.0.22631

  2. ThomasSoeiro commented on Sep 22, 2026

    @ThomasSoeiro
    CollaboratorAuthor

    @grantmcdermott REditorSupport/jgd@3c557c6 seems to have fixed jgd but the issue still (randomly?) occurs with the default plot viewer.

    Another focus issue is that the plot viewer does not regain focus when the data viewer has taken focus:

    plot(mpg ~ hp, mtcars)
    View(mtcars)
    plot(mpg ~ wt, mtcars) # does not regain focus
    
  3. changed the title [-]The editor (sometimes) loses focus when commands that open an interactive viewer are executed[/-] [+]The editor/console (sometimes) loses focus when commands that open an interactive viewer are executed[/+] on Sep 22, 2026
  4. ThomasSoeiro commented on Sep 23, 2026

    @ThomasSoeiro
    CollaboratorAuthor

    @eitsupi @Fred-Wu @grantmcdermott can you please add the "confirmed" tag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions