microsoft / microsoft/vscode

Parent folder remains selected after navigating into it with ↓, causing accidental deletion

Open
#334,993 0 comments 0 reactions 1 assignee Claimed by @lramos15 View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

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

VS Code Version: 1.136.1
OS Version: Sonoma 14.0 (23A344)

In the VS Code Explorer, when you select a parent folder and press `↓` (Down Arrow), the keyboard focus indicator (the dashed border) does move to the next item (e.g., the first child inside the folder). However, the visual selection highlight (the solid background) remains on the original parent folder. Pressing Shift + ↓ expands the selection to include child items, but the parent folder stays selected as well. If you then right‑click any of the selected child items and choose `Delete` from the context menu, the command acts on the entire selection — which still includes the parent — rather than just the child items you intended. As a result, the parent folder (and all its contents) gets deleted.

Steps to Reproduce:

1. In the VS Code Explorer, click once on a parent folder to give it focus and select it.
2. Press the ↓ (Down Arrow) key once.
3. The selection highlight moves down to the first child item inside/under the parent.
4. The mouse focus indicator remains on the parent folder.
5. Press `Shift + ↓` one or more times to extend the selection to additional child items.
6. Right‑click on any of the visually selected child items to open the context menu.
7. Click Delete from the context menu.

https://github.com/user-attachments/assets/ca1a007e-7cf7-4a09-89f5-047bceedf5a9

Expected Behavior:

When you press the down arrow, the focus indicator should visually move away from the parent along with the selection highlight. Currently, it stays on the parent, and that's what causes the delete action to target the wrong item.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.