Skip to content

Focused item in tree is never unfocused #171550

Open

Description

Does this issue occur when all extensions are disabled?: No - issue with trees contributed by any extension

  • VS Code Version: 1.75.0-insider
  • OS Version: Darwin x64 22.2.0
VS Code details

Version: 1.75.0-insider
Commit: 1379f03
Date: 2023-01-17T05:21:02.509Z
Electron: 19.1.9
Chromium: 102.0.5005.194
Node.js: 16.14.2
V8: 10.2.154.23-electron.0
OS: Darwin x64 22.2.0
Sandboxed: Yes

Steps to Reproduce:

I edited the tree-view-sample extension to provide a minimal reproducible example https://github.com/alexweininger/vscode-extension-samples/tree/alex/focus-never-unset/tree-view-sample

  1. Clone and run the edited tree-view-sample
  2. Before selecting or focusing any tree items, click the "Test View: Change Title" button on the view title bar.

image

Observe that the focusedNode and selectedNode arguments are both undefined as expected.
image

image

  1. Select or focus a tree item.
  2. Click the "Test View: Change Title" button again.

focusedNode is set as expected
image

  1. Press the Escape key, or unfocus the tree with your mouse by clicking outside. The UI shows no focused items.

image

  1. Without selecting or focusing tree items, click the "Trest View: Change Title" button.

Expect: focusedNode argument should be undefined.

Actual: focusedNode is set to the last node that had focus in the tree.

image

It seems that the focused item is unable to be "reset", and only able to change to a different item. I don't think this is intended behavior, since the UI doesn't display any item as being focused. This creates confusion as commands may act differently depending on if focusedNode is defined.

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

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugtree-viewsExtension tree view issues

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions