Repository: vscode
Issue: Focused item in tree is never unfocused
Labels: bug,tree-views

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: **No** - issue with trees contributed by any extension
<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.75.0-insider
- OS Version: Darwin x64 22.2.0

<details>
<summary>VS Code details</summary>

Version: 1.75.0-insider
Commit: 1379f0375440df946adc62f7afb8375dd45d5adf
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

</details>

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.
<img width="572" alt="image" src="https://user-images.githubusercontent.com/12476526/213016670-31b859b7-b69d-406c-b88b-70ee0f8b9c81.png">

Observe that the `focusedNode` and `selectedNode` arguments are both undefined as expected.
<img width="1151" alt="image" src="https://user-images.githubusercontent.com/12476526/213017014-145d1b70-ee1d-4902-8454-f907b78772cc.png">

<img width="238" alt="image" src="https://user-images.githubusercontent.com/12476526/213016974-7f72ab78-974e-4527-a8cd-6affc357b50f.png">

3. Select or focus a tree item.
4. Click the "Test View: Change Title" button again.

`focusedNode` is set as expected
<img width="234" alt="image" src="https://user-images.githubusercontent.com/12476526/213017139-46d77ee7-56d6-43ff-a74d-5a5c1e149895.png">

5. Press the Escape key, or unfocus the tree with your mouse by clicking outside. The UI shows no focused items.

<img width="417" alt="image" src="https://user-images.githubusercontent.com/12476526/213017402-77528b67-a7d6-44aa-b86e-b103a65609af.png">

6. 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. 

<img width="248" alt="image" src="https://user-images.githubusercontent.com/12476526/213017544-7243e980-2937-4a69-bfa6-b436ed44baa3.png">

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.