Skip to content

Explorer rename input closes when switching input sources on GNOME Wayland #338125

Closed

Description

@r3na7

Does this issue occur when all extensions are disabled?: Yes

Switching input sources through GNOME Shell's switcher closes the file rename input in Explorer when VS Code uses its native Wayland backend.

Environment

  • Ubuntu Linux, GNOME Shell 46.0, Wayland session
  • VS Code 1.139.1 (04c0d99f4fb0d8afe6ce4f0c58e31e183ac3e4b1)
  • Electron 43.6.0, Chromium 150.0.7871.250
  • Linux x64 7.0.0-34-generic
  • English and Russian input sources

Also reproduced in a development build with extensions disabled and a separate user-data directory.

Steps to reproduce

  1. In a GNOME Wayland session, configure at least two input sources.
  2. Launch VS Code with --ozone-platform=wayland.
  3. Open a folder, select a file in Explorer, and press F2.
  4. Edit its name without pressing Enter or Escape.
  5. Switch input sources using the configured GNOME shortcut, for example Super+Space.

Actual: The rename input closes. A valid pending filename can be accepted even though the user only switched input sources.

Expected: The rename input stays open, preserving the pending name and selection so typing can continue.

Launching the same application with --ozone-platform=x11 avoids the problem. This is a comparison to isolate the Wayland path.

Investigation

The blur handler in FilesRenderer.renderInputBox (src/vs/workbench/contrib/files/browser/views/explorerViewer.ts) checks ownerDocument.hasFocus() before checking whether the rename input remains the document's active element. Losing page focus can therefore finish editing even when DOM focus has not moved to another element.

A local change that checks ownerDocument.activeElement first fixes the input-source switching scenario in manual testing. An Electron regression test using the real renderer reproduces the page-blur case and fails without that change. A second test checks that moving focus to another input still finishes editing.

The automated tests cover page-focus handling; the GNOME input-source switching scenario was verified manually. No Wayland protocol trace was captured.

Activity

  1. added
    unreleased
    on Oct 20, 2026
  2. added this to the 1.144.0 milestone on Oct 20, 2026
  3. vs-code-engineering commented on Oct 20, 2026

    @vs-code-engineering
    Contributor

    Sharing media and context from merged PR #338126 for verification:

    Switching input sources through GNOME Shell's switcher on Wayland can close the Explorer rename input and accept a valid pending filename. The blur handler checks document.hasFocus() first, so losing page focus finishes editing even when the input remains the document's active element.

    Check the input's own ownerDocument.activeElement before deciding to finish editing. This preserves the input, pending text and selection when the page loses focus. Moving focus to another element in the document still finishes editing, and the existing context-menu handling is retained.

    This intentionally also preserves rename across window switches such as Alt+Tab, provided the input remains its document's active element.

    Adds two Electron tests using the real FilesRenderer: preserving rename on page blur, and finishing it when focus moves to another input. A test-only IPC helper focuses a second WebContentsView to produce page blur without changing the original document's active element.

    Validation (rechecked after rebasing onto c94d3d7ed24, with Electron 43.7.3):

    • Before rebasing, the preservation test was verified to fail without the fix. Both new tests pass with the fix after rebasing, using the Wayland backend.
    • TypeScript checking, ESLint on the changed files, and git diff --check passed.
    • Manually verified on GNOME Shell 46.0 / Wayland: switching input sources preserves rename with the fix and closes it without the fix. Enter, Escape and dismissing the input context menu before continuing to type also work.

    To reproduce: select a file in Explorer, press F2, edit the name without confirming, then switch input sources using the configured shortcut (for example, Super+Space). The input should remain open. The GNOME switcher scenario was verified manually; the automated tests cover page-focus handling.

    Run the tests after compiling:

    ./scripts/test.sh --ozone-platform=wayland --run src/vs/workbench/contrib/files/test/electron-browser/explorerRename.test.ts

    Demo

    Before the fix — installed VS Code, Wayland:

    Screencast.from.2026-09-30.21-44-27.mp4

    After the fix — development build with this PR, Wayland:

    Screencast.from.2026-09-30.21-46-20.mp4

    Source PR: #338126

  4. added
    insiders-released
    and removed
    unreleased
    on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

insiders-released

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions